【发布时间】:2016-01-27 23:35:03
【问题描述】:
我最近开始使用 grunt,但似乎无法正常工作:我使用 npm 安装了 grunt-cli,还使用 npm 安装了一些 grunt 模块,没有任何问题。我正在尝试将所有引导框架的 less 文件编译到一个 css 文件中,但不断收到错误消息,提示找不到 less 任务。我确定一切都在它应该在的地方,我在 gruntfile 中加载了 grunt-contrib-less 插件。知道我哪里可能出错了吗?
我的 package.json 的内容:
{
"name": "dConference",
"version": "0.1.0",
"devDependencies": {
"grunt": "latest",
"grunt-contrib-jshint": "latest",
"jshint-stylish": "latest",
"grunt-contrib-uglify": "latest",
"grunt-contrib-less": "latest",
"grunt-contrib-cssmin": "latest",
"grunt-contrib-watch": "latest"
}
}
还有我的 gruntfile.js 的内容:
//gruntfile specifying all tasks to be performed
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//all configuration goes here
less: {
build: {
files: [{
expand: true,
cwd: "components/less",
src: ["*.less"]
dest: "css/main.css"
} ]
}
}
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-watch");
};
【问题讨论】:
标签: javascript node.js twitter-bootstrap gruntjs