我已经定义了一个uncss grunt任务,我想将文件夹/css中所有文件的内容添加.min.css,但是当我运行grunt命令并保存我的CSS更改(任务正在监听)时,我在控制台中得到以下错误:
Unable to write "css" file (Error code: EISDIR
这是我的cssmin任务:
// Cssmin task config
cssmin: {
target: {
files: [{
src: ['css/*.css', 'css/!*.min.css'],
dest: 'css',
}]
}
}
以下是我的完整Gruntfile.js:
//Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
// Watch task config con Sass
watch: {
sass: {
files: "scss/*.scss",
tasks: ['sass']
},
cssmin: {
files: "css/*.css",
tasks: ['cssmin']
}
},
// Sass task config
sass: {
dev: {
files: {
// fichero destino // fichero .scss
"css/custom.css" : "scss/custom.scss"
}
}
},
// BrowserSync task config
browserSync: {
default_options: {
bsFiles: {
src: [
"css/*.css",
"js/*.js",
"*.html"
]
},
options: {
watchTask: true,
proxy: "tutorialmaterialize.dev"
}
}
},
// UnCSS task config
uncss: {
dist: {
options: {
//Estilos que queremos limpiar
stylesheets : ['css/materialize.min.css'],
//Estilos que no queremos limpiar
ignoreSheets: [/custom.css/],
},
files: {
//Archivo css de salida //Scanea las clases, ids, etc de este html
'css/materialize.min.css': ['index.html']
}
}
},
// Cssmin task config
cssmin: {
target: {
files: [{
src: ['css/*.css', 'css/!*.min.css'],
dest: 'css',
}]
}
}
});
//Cargamos los grunt plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-uncss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
//Tarea por defecto
grunt.registerTask('default', ['browserSync', 'watch']);
};
最终,这是我的项目结构:
materialize-css/
|--css/
| |--materialize.min.css
| |--custom.css
|
|--img/
|
|--fonts/
| |--material-design-icons
| |--roboto
|
|--js/
| |--materialize.min.js
|
|--index.html
我该怎么修复这个问题?