I am using dotnetless (http://www.dotlesscss.org/) for asp.net
web forms applications, and it works great. I like using variables for colors, font-size etc. But so far as I can see variable values are static.
Is there any way using dotnetless to initialize these variables values from a database depending on userid?
Basically I want to convert this web application into a theme based website, so each user can select there own color, font, font-size etc.
Any direction will be greatly appreciated.
You can import a . less file, and all the variables in it will be available.
The best way to do this is to @import your LESS file with all your variables in it. Here's the syntax for the @import keyword: // For LESS file includes, @import "lib. less"; // or @import "lib"; // infers the .
The var() function is used to insert the value of a CSS variable. CSS variables have access to the DOM, which means that you can create variables with local or global scope, change the variables with JavaScript, and change the variables based on media queries.
It is definitely possible, but unfortunately you can't query your database from LESS itself, so you basically need to write the LESS file for the user with the variable values needed, and then load it.
You can find an example from another answer here: https://stackoverflow.com/a/11628325/2330244
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With