gpt4 book ai didi

gruntjs - grunt-contrib-less 不工作(没有错误但没有输出 css)

转载 作者:行者123 更新时间:2023-12-02 01:42:58 26 4
gpt4 key购买 nike

我有一个 less 编译 grunt 任务,其中从 grunt 安装文件夹到 less 文件的相对路径是 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 任务,没有任何选项。谁能指出这有什么问题。

最佳答案

编辑:我有问题。它不起作用,因为更少的任务需要特定的目标才能工作。
尝试像这样更改代码

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

关于gruntjs - grunt-contrib-less 不工作(没有错误但没有输出 css),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27375662/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com