用Grunt构build手写笔主题

我希望我的手写笔文件接受来自grunt的variablesinput,循环variables值,并输出不同的主题CSS文件。

然后,我可以轻松地切换这样的主题。 https://stackoverflow.com/a/7847009/55124

这可能吗? 如何设置它?

现在我咕噜地编写我的CSS的手写笔。 但是,要生成一个不同的主题,我不得不手动改变我mainCSS.stylus文件中的我的themeNamevariables的值,并用grunt重build。

你怎么看待这种方式:

有一个main.styl,包含:

@import "variables"; //some other styles and imports 

还有一些主题文件:

  themes/default.styl themes/pretty-theme.styl themes/very-pretty-theme.styl 

使用grunt-contrib-copy你可以将文件themes / default.styl复制到variables.styl并将手写笔编译成css样式,然后删除variables.styl并再次将themes / pretty-theme.styl复制到variables.styl并编译等。

 copy: { default-theme: { src: 'themes/default.styl', dest: 'variables.styl', }, pretty-theme: { src: 'themes/pretty-theme.styl', dest: 'variables.styl', }, very-theme: { src: 'themes/very-pretty-theme', dest: 'variables.styl', }, }