how to use dynamically dotless variables. I mean how to assign value dynamically in dotless file. Is there any way?
style.less file contain
@url_image:
#head{ background: url(@url_image) no-repeat left top white;}
How can I assign a value at runtime?
When you say change dynamically in .less file, I am not sure why you wanna just change it in less file. If you just change it in .less file, you'll have to compile the file in order to navigative the change to style.min.css and style.css files, which you can't do programmatically.
This is what you can do:
So jquery/javascript is your best bet
There are a number of ways to do this. In my case, both the less content and dynamic parameters are stored in the DB. You can do something like this if you want to change a hex code color for example:
This isn't an end all solution since there are many other types of parameters, but it should lead you in the right direction. Look in the dotless.Core.Parser.Functions for useful information on the various options.
Alternatively, there is another simple option. With the code above, you can simply append the changed variables to the end of the css.Detail.Text string. This is actually how the modifyVars method works in the less.js file. By adding the parameters again at the end, it overrides the previous set values.
This can be done if you manually parse and output the dotless file.