我有一个较少编译的grunt任务,其中来自grunt安装文件夹的较少文件的相对路径为raw/less/source_map/
这是grunt文件。
Gruntfile :( 编辑:改为@Yogesh Khatri的代码仍然是同样的问题)
module.exports = function(grunt) {
grunt.initConfig({
less: {
files: { "raw/less/source_map/style.css" : "raw/less/source_map/style.less" }
},
watch: {
js: {
files: ['raw/less/source_map/style.less'],
tasks: ['default'],
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less']);
};
运行它时命令行显示
^CMacPro:grunt sagiavinashvarma$ grunt watch
Running "watch" task
Waiting...
>> File "raw/less/source_map/style.less" changed.
Running "less:files" (less) task
Done, without errors.
Completed in 1.862s at Tue Dec 09 2014 15:03:37 GMT+0530 (IST) - Waiting...
但没有style.css输出。我编写了最简单的grunt任务,没有任何选项。 任何人都可以指出这是错误的。
答案 0 :(得分:2)
修改强> 我遇到了问题。它不起作用,因为较少的任务需要特定的目标才能工作 尝试更改像这样的代码
module.exports = function(grunt) {
grunt.initConfig({
less: {
development: {
files: { "raw/less/source_map/style.css" : "raw/less/source_map/style.less" }
}
},
watch: {
js: {
files: ['raw/less/source_map/style.less'],
tasks: ['default'],
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less']);
};
我通过运行grunt --verbose
得到了错误,显示了有关任务的更多信息。它给了我像
Verifying property less.files exists in config...OK
File: [no files]
Options: report="min", banner=""
>> Destination not written because no source files were provided.
其中搜索引导我: - grunt-contrib-less cannot find source files even though path is correct