我有一個Gruntfile
寫在CoffeeScript
,並且在cssmin
任務運行時我總是收到(Error code: EISDIR)
。運行在詳細模式下任務後,我得到這樣的信息:Grunt.js,警告:無法寫入「src」文件(錯誤代碼:EISDIR)
Running "cssmin" task
Running "cssmin:src" (cssmin) task
Verifying property cssmin.src exists in config...OK
Files: assets/z.styles.concat.css.liquid -> src
Options: report=false
Reading assets/z.styles.concat.css.liquid...OK
Writing src...ERROR
Warning: Unable to write "src" file (Error code: EISDIR). Use --force to continue.
這裏是我的cssmin任務:
cssmin:
src: 'assets/z.styles.concat.css.liquid'
dest: 'assets/styles.min.css.liquid'
的z.styles.concat.css.liquid
之後concat
運行創建併成功輸出到資產的文件夾。 src屬性中列出的路徑是正確的。
任何想法可能會拋出錯誤?
此外,這裏是整個gruntfile爲connivence。
Grunt.coffee:
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
files:
grunt: ['gruntfile.js']
css: ['assets/screen.css', 'assets/styles.css.liquid']
scss: ['src/scss/**/*.scss']
js: ['src/js/**/*.js'] #(if we need liquid templating), 'src/js/**/*.js.liquid', 'assets/**/*.js.liquid']
coffee: ['src/js/coffee/**/*.coffee', 'src/js/coffee/**/*.coffee.liquid']
img: ['src/images/**/*.{png,jpeg,svg,jpg,gif}']
# Image Processing
smushit:
path:
src: '<%= files.img %>' #recursively replace minified images
dest: 'assets'
# Concatenation Processing
concat:
css:
src: ['<%= files.css %>']
dest: 'assets/z.styles.concat.css.liquid'
js:
src: ['<%= files.js %>']
dest: 'src/js/z.scripts.concat.js'
# JavaScript Processing
coffee:
app:
expand: true
cwd: 'src/js/coffee'
src: ['**/*.coffee', '**/*.coffee.liquid']
dest: 'src/js'
ext: '.js'
uglify:
dist:
src: ['src/js/z.scripts.concat.js']
dest: 'assets/scripts.min.js'
jshint:
files: ['<%= files.grunt %>', 'src/js/z.scripts.concat.js']
options:
jquery: true
smarttabs: true
curly: true
eqeqeq: true
immed: true
latedef: true
newcap: true
noarg: true
sub: true
undef: true
boss: true
eqnull: true
browser: true
globals:
jQuery: true
console: true
undef: true
unused: false
# CSS Processing
compass:
dist:
options:
sassDir: 'src/scss'
cssDir: 'assets'
imagesDir: 'assets',
javascriptsDir: 'assets',
outputStyle: 'expanded'
cssmin:
src: 'assets/z.styles.concat.css.liquid'
dest: 'assets/styles.min.css.liquid'
# watch tasks
watch:
options:
nospawn: true
events: ['changed', 'added']
files: [
'<%= files.js %>'
'<%= files.coffee %>'
'<%= files.scss %>'
]
tasks: ['default']
# These plugins provide necessary tasks.
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-smushit'
grunt.loadNpmTasks 'grunt-contrib-compass'
# Default task.
grunt.registerTask 'default', [
'coffee'
'concat:js'
'jshint'
'uglify'
'concat:css',
'cssmin'
]
# Minify task
# Run the default task then losslessly minify images with Yahoo!'s Smush-It
grunt.registerTask 'minify', ['default', 'smushit']
你可以嘗試使用--verbose選項運行任務嗎? –
只要運行咕嚕your_task_name --verbose –
@AndreyShustariov剛剛更新的問題 – agconti