Tuesday, January 8, 2019

LESS options switches!

"ASP.NET Core 2 and Angular 5" by Valerio De Sanctis gives more detail than I expected on LESS importing on pages 270 and 271. For example this...

@import "watermelon";

 
 

...and this:

@import "watermelon.less";

 
 

...in a LESS (Leaner Style Sheets) file, turns the guts of the LESS content into CSS and injects it into the file made when the referencing file gets made into CSS too while...

@import "watermelon.css";

 
 

...merely loops in some CSS. Alright, that's not crazy, but did you know that you may have options switches like so?

@import (less,css,optional) "watermelon.css";

 
 

The options are:

  • reference references the other file externally like the CSS @import flavor of things
  • inline does not cast LESS to CSS in importation
  • less imports as if .less without regard to extension
  • css imports as if .css without regard to extension
  • once will restrict the number of times the content may be spliced in to once
  • multiple will have multiple copies of the same content in the file getting the splice in if applicable
  • optional means do not break the compiler if you can't find it

No comments:

Post a Comment