Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ES6 imports - what does the exclamation mark mean?

I'm following along with the Choose ES6 Modules Today guide, and I noticed one of the import statements he's using has an exclamation mark at the end:

import 'bootstrap/css/bootstrap.css!';

What does that exclamation mark signify?

This import statement appears on the first line of the startup.js file.

like image 361
Sergey K Avatar asked Jul 24 '15 21:07

Sergey K


People also ask

What does the exclamation mark mean in JavaScript?

In Javascript, the exclamation mark (“!”) symbol, called a “bang,” is the logical “not” operator. Placed in front of a boolean value it will reverse the value, returning the opposite. ! true; // Returns false.

What is exclamation mark after variable JavaScript?

produces a value of the type of x with null and undefined excluded. The description contains many fancy words, but in plain English, it means: when you add an exclamation mark after variable/property name, you're telling to TypeScript that you're certain that value is not null or undefined.

What is exclamation mark after variable TypeScript?

What is the TypeScript exclamation mark? The non-null assertion operator tells the TypeScript compiler that a value typed as optional cannot be null or undefined . For example, if we define a variable as possibly a string or undefined, the !

What does exclamation mark after variable mean?

The exclamation mark (non-null assertion) operator removes null and undefined from the type of an expression. It is used when we we know that a variable that TypeScript thinks could be null or undefined actually isn't.


1 Answers

It means that a plugin will be called to load the file. By default the plugin/loader name equals the extension name. So in your example the css plugin will be called to load the bootstrap/css/bootstrap.css file. One can define the plugin explicitly:

import 'bootstrap/css/bootstrap.css!css';

or

import 'bootstrap/css/bootstrap.css!customCssLoader';

Plugins have to be installed like any other normal module. More about this syntax here.

like image 120
Oleksii Rudenko Avatar answered Sep 27 '22 16:09

Oleksii Rudenko