Can the console register a LESS variable at compile time?

I am doing some debugging of a very complex system of parent / child themes using Bootstrap and LESS CSS. I will not go into details of this problem, except to say that I declare custom colors and other variables in variables.less , but the compiled CSS does not use these variables, however , I've verified that the file is actually compiled and successfully included .

So, I really need to be able to somehow console.log LESS variables (especially during compilation time), but despite the fact that LESS claims to support javascript inside LESS files, this does not work. Can anyone shed some light on this / have experience with it?

+6
source share
2 answers

but even though LESS claims to support javascript inside LESS files, this does not work.

It:

 @var: value; .test { width: ~`console.log("@{var}"), "@{var}"`; } 
+3
source

Try wrapping your JavaScript in a function expression with an instant call. As long as you return a value that is less than expectations, everything else that happens in this function looks honest:

 @myColor: red; .test { color: `(function(){console.log("@{myColor}"); return "@{myColor}";}())` } 
+1
source

All Articles