【发布时间】:2015-09-11 13:56:53
【问题描述】:
我当前的 Grunt 代码:
module.exports = function(grunt) {
grunt.initConfig({
// running `grunt less` will compile once
less: {
development: {
options: {
paths: ["custom"],
yuicompress: true
},
files: {
"custom/file1.css": "custom/*.less",
"custom/file2.css": "custom/*.less"
}
}
},
// running `grunt watch` will watch for changes
watch: {
files: "custom/*.less",
tasks: ["less"]
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.registerTask('default', ['less:development']);
};
与其指定两个单独的文件“file1”和“file2”,我更希望它编译和查看“custom”中的所有 .less 文件。
【问题讨论】:
-
见gruntjs.com/configuring-tasks#compact-format(具体例子见stackoverflow.com/a/18728776/2712740)。 (另请注意,大约两年前,
yuicompress选项已从grunt-contrib-less中删除)。