syntax error - Importing a file with LESS won't see the @filename var -
i'm trying load .less
file main theme, filestructure:
main.less themes/pink.less themes/yellow.less themes/blue.less
i'm using mixin
retrieve selected theme:
.theme(@filename){ @import 'themes/@{filename}.less'; } .theme('pink');
it doesn't work , error:
syntaxerror: variable @filename undefined .theme('pink');
i'm used same background images without getting errors, i'm wrong?
unfortunately less.js throws error describe imports .less
files (it works fine imports .css
files), if define variable in in mixin parameter/attribute, works if define variable directly inside (localy) or outside mixin (globaly). example, should work:
@filename: 'pink'; .theme(){ @import 'themes/@{filename}.less'; } .theme();
here link discussion plan of implementing has been discussed while ago, , seems longterm goal have version working well, hasn't happened yet ^_^
however, if want load theme according variable, can without mixin. doing this:
@theme: 'pink'; @import 'themes/@{theme}.less';
Comments
Post a Comment