Dynamically change countless parameters

I would like to save dimensionless parameters in the database, an example of use might be that the color changes for each user based on his or her preferences.

I believe that the best way to do this is to parse all inactive files to get the parameters, the user can then set the parameters that will be stored in the database against the user. When fewer files are requested, overloading the handler may request a database for parameters. Then the handler can output css with the parameters set.

Questions: - How can I take the .less file and get a list of parameters? - How can I take a .less file as an array of parameters (a pair of key values) and css output?

All using countless frameworks.

+5
source share
2 answers

There may be a late answer, but we did something similar to your requirement, where we had custom colors based on users stored in the database.

Our solution was to add custom code to the lossless source, which is available here. I believe https://github.com/dotless/dotless

So, during the analysis, he simply replaced the parts that we wanted to replace. The only drawback of this approach is getting updated builds of the new dotll dll, which we need to regenerate our source every time.

EDIT Here is an example code snippet:

dotless.Core.Utils.HslColor hslcolor = dotless.Core.Utils.HslColor.FromRgbColor( new dotless.Core.Parser.Tree.Color( "187AAB" );
                hslcolor.Lightness = 0.93;
                var hexString = '#' + ( hslcolor.ToRgbColor().RGB.Select( i => ( ( int )i ).ToString( "X2" ) ).Aggregate( ( a, b ) => a + b ) ).ToLowerInvariant();
                var resultColor = hexString;
+3
source

.Net, dotless , . , . Dotless patamteres, .

. , " " .

+2

All Articles