less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

Passing additional CSS directives to the whitelist from the environment #1419

Closed mdarens closed 8 years ago

mdarens commented 11 years ago

I'm attempting to get less.js working with PrinceXML, and their vendor-specific directives (notably @prince-color) and properties aren't prefixed with -. For properties this doesn't cause any issue, but the less parser expects them in directives and will otherwise choke. I think it would be nice to be able to pass additional allowed directives in at run time. Does anybody else think this sounds like a good idea?

lukeapage commented 11 years ago

Specifically telling less what type of directive it is.. we could maybe try to be more tolerant of directives we don't recognize too.

mdarens commented 11 years ago

Perhaps LESS should simply pass through any unknown @ token which is immediately followed by a block as-is, then attempt to parse any additional instructions inside the block, since variable declarations aren't followed by blocks, as LESS leaves that to mixin declarations. That way the parser looking at the result, which is usually the one actually applying/rendering styles, can safely decide if it wants to discard the whole rule, seeing as how the spec doesn't currently take a strong position on prefixes.

wachunga commented 10 years ago

I also just encountered this problem. Some kind of configuration here would be handy.

matthew-dean commented 8 years ago

Closing as this is implemented in https://github.com/less/less.js/pull/2783.