Saturday, 15 August 2015

css3 - lesscss: how to reparse everything from javascript? -



css3 - lesscss: how to reparse everything from javascript? -

my less file dependent on many variables such as:

@fontregular: "avenirnextcondensed-regular";

and classes create utilize of variables, follows:

.thisclass { font-family: @fontregular; }

as can expect, need retheme on-the-fly.

the theme redefines variable, follows):

@fontregular: "helveticaneue";

how can require less reparse (i mean less file) , how can alter variables first?

simply invoke less javascript (in case, it's controller) follows:

less.modifyvars( $scope.config.fontstylehelveticaneue? { '@fontregular': "helveticaneue", '@fontultralight': "helveticaneue-ultralight", '@fontdemibold': "helveticaneue-condensedbold" } : { '@fontregular': "avenirnextcondensed-regular", '@fontultralight': "avenirnextcondensed-ultralight", '@fontdemibold': "avenirnextcondensed-demibold" } );

where on illustration above, @-prefixed words less variables update (actually, there 2 set there). less rebuild css automatically.

css3 parsing themes less

No comments:

Post a Comment