3
我最近開始使用grunt,似乎無法讓它工作:我使用npm安裝了grunt-cli,並且使用npm安裝了幾個grunt模塊,沒有問題。我試圖將所有引導框架的少文件編譯成一個css文件,但不斷收到一個錯誤,說沒有找到更少的任務。我確定一切都在它應該是的地方,我在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");
};
我添加了結束[但仍然得到相同的錯誤... – user2094257
請在這裏發佈整個Gruntfile.js文件 –
感謝您的採訪。我剛剛更新了我的問題與grunt.js文件內容 – user2094257