【发布时间】:2016-03-12 08:00:22
【问题描述】:
除非我误解了this documentation,否则可以在您的Gruntfile 中定义一个全局less 变量并在您的.less 文件中引用它(假设有原因)。
less: {
modVar: {
options: {
plugins: [
new (require('less-plugin-autoprefix'))
],
modifyVars: {
root: "<%= grunt.option('distRoot') %><%= grunt.option('distTarget') %>"
},
root: "<%= grunt.option('distRoot') %><%= grunt.option('distTarget') %>",
},
files: {
'<%= yeoman.dist %>/styles/main.less' : '<%= yeoman.app %>/styles/{,*}*.less'
}
},
那(上图)是我对Gruntfile 的条目,我试图在我的一个.less 文件(main.less)中引用变量root,但每次它都会抛出一个错误在我的控制台中,main.less 中的“@root is undefined”。我是否误解了grunt-contrib-less 的可能性?还是我只是做错了什么?
【问题讨论】: