我一直很高兴地使用gulp.js进行编译,但今天下午我开始收到这样的错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: Broken @import declaration of "A"
我的gulpfile.js看起来像这样:
var gulp = require('gulp'),
minifyCSS = require('gulp-minify-css'),
sass = require('gulp-ruby-sass'),
imagemin = require('gulp-imagemin')
minifyHTML = require('gulp-minify-html'),
uglify = require('gulp-uglify'),
fileinclude = require('gulp-file-include');
gulp.task('sass', function() {
return sass('node_modules/foundation/scss/')
.on('error', function (err) {
console.error('Error!', err.message);
})
.pipe(gulp.dest('publish/css'));
});
gulp.task('image', function(){
gulp.src('images/*')
.pipe(imagemin())
.pipe(gulp.dest('publish/images'));
});
gulp.task('fileinclude', function() {
gulp.src(['index.html'])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('./html/'));
});
gulp.task('minify-css', function() {
gulp.src('publish/css/*.css')
.pipe(minifyCSS({keepBreaks:false}))
.pipe(gulp.dest('publish/css'));
});
gulp.task('compress', function() {
return gulp.src(['./node_modules/foundation/js/foundation/*.js','./node_modules/foundation/js/vendor/*.js'])
.pipe(uglify())
.pipe(gulp.dest('publish/js'));
});
gulp.task('minify-html', function() {
var opts = {
conditionals: true,
spare:true
};
return gulp.src('./html/*.html')
.pipe(minifyHTML(opts))
.pipe(gulp.dest('./publish/'));
});
gulp.task('watch', function(){
gulp.watch('node_modules/foundation/scss/', ['sass']);
gulp.watch('publish/css/*', ['minify-css']);
gulp.watch('publish/images/*', ['image']);
});
gulp.task('alpha', [ 'sass','fileinclude','minify-css','image','compress' ]);
gulp.task('omega', ['minify-html']);
gulp.task('build', ['alpha', 'omega']);
gulp.task('default', ['build']);
我已经重新启动,尝试检查端口冲突和谷歌这详尽。
有人能看出可能导致此问题的明显问题吗?
编辑:我应该补充一点,我使用的是Foundation框架。
1条答案
按热度按时间rbpvctlc1#
gulp-minify-css
软件包是我的罪魁祸首。我把这个参数添加到我的gulpfile.js
文件中,它修复了这个问题:例如: