我是Grunt的新手。我想我會試試看,所以我創建了這個咕嚕聲文件。咕嚕文件失敗'由於警告而中止'
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
css: {
src: [
'./css/*'
],
dest: './css/all.css'
},
js: {
src: [
'./js/*'
],
dest: './js/all.js'
}
},
uglify: {
js: {
files: {
'./js/build/all.min.js': ['./js/all.js']
}
}
},
sass: {
build: {
files: [{
expand: true,
cwd: './css/sass',
src: ['*.scss'],
dest: './css',
ext: '.css'
}]
}
},
cssmin: {
css: {
src: './css/all.css',
dest: './css/build/all.min.css'
}
},
watch: {
files: ['./css/sass/*', './js/*'],
tasks: ['sass:build','concat:css', 'cssmin:css', 'concat:js', 'uglify:js']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('dev', ['sass:build','concat:css', 'cssmin:css', 'concat:js', 'uglify:js']);
};
當我運行'grunt watch'並對.scss文件進行更改時,終端抱怨然後終止。
Running "watch" task
Waiting...
>> File "css/sass/all.scss" changed.
Running "sass:build" (sass) task
File css/all.css created.
Running "concat:css" (concat) task
Warning: Unable to read "./css/build" file (Error code: EISDIR). Use --force to continue.
Aborted due to warnings.
Completed in 1.276s at Thu May 01 2014 23:53:59 GMT+0100 (BST) - Waiting...
請有人指出我要去哪裏錯了嗎?
它看起來與concat:css
-但沒有參考建立目錄那裏。
我認爲這可能是因爲某些任務正在發生碰撞,並且文件尚未準備好,可能還沒有準備好?有任務的訂單嗎?
請耐心等待,因爲它是全新的!
謝謝, 邁克爾。