Import directives

Another LESS key feature is the capability of importing other CSS and LESS files. If we're familiar with the standard CSS @import, we know that it can only be used at the beginning of the file to issue the loading of an external CSS file. With LESS, we can do the following:

// look for a style.less file and process + import its contents.
@import "style"; 

// look for a style.less file and process + import its contents.
@import "style.less"; 

// look for a style.css file and import its contents (no processing).
@import "style.css"; 

Note that the behavior depends on the imported file extension. These defaults can be overridden with the following options switches:

// link/use a Less file without including it in the output. @import ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.