Spadar Shut
Spadar Shut

Reputation: 15797

LESS - import a file but not print it

I need to compile a LESS file and mix in some of the classes used in other files, but I don't want to print the whole contents of the imported files.

This looks pretty much like silent selectors in SASS. How can this be achieved?

Upvotes: 0

Views: 163

Answers (1)

Nick Tomlin
Nick Tomlin

Reputation: 29221

"muted" imports are not yet implemented in the current stable version of less (1.4.2 as of as of this post), but are planned for inclusion in 1.5.0. source @github issues

They don't seem to be working in the current beta, but when they are finally baked in, the implementation should like this:

PSEUDO CODE

reference.less:

.not-awesome {
  color: red;
}

.awesome {
 color: blue;
}

main.less:

@import (mute) "foo.less";

.more-awesome:extend(.awesome){
  font-size:8em;
}

output:

.awesome,
.more-awesome {
  color: blue;
}
.more-awesome {
  font-size: 8em;
}

Upvotes: 2

Related Questions