【发布时间】:2016-02-14 00:20:33
【问题描述】:
我有一个文件结构复杂的项目,其中的模块有自己的 css/less/sass 文件夹。
我希望 grunt 观察所有这些并将它们编译为目标文件,方法是将最后一个 lass/sass 文件夹替换为 css。编译文件示例
root/less/style.less -> root/css/style.css
或
root/modules/mymodule/sass/file.sass -> root/modules/mymodule/css/file.css
我现在的 gruntfile 是:
less: {
development: {
options: {
paths: ["**/*"]
},
//files: {"css/main.css": "less/main.less"},
files: [
{
expand: true,
cwd: "**/*",
src: ["**/*.less"],
dest: "",
ext: ".css"
}
]
}
// ,
// production: {
// options: {
// paths: ["assets/css"],
// cleancss: true
// },
// files: {"path/to/result.css": "path/to/source.less"}
// }
},
watch: {
styles: {
files: ['less/**/*.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
}
}
});
但它不起作用。
【问题讨论】: