当我运行gulp命令时,此错误被炸毁
了如果你有一些想法如何解决这个问题,我准备听(( ! 如果你有一些想法如何解决这个问题,我准备听((
> C:UsersP.A.N.D.E.M.I.CDesktoptrygulpfile.js:19
> .pipe(livereload());
> ^ SyntaxError: Unexpected token .
> at createScript (vm.js:56:10)
> at Object.runInThisContext (vm.js:97:10)
> at Module._compile (module.js:542:28)
> at Object.Module._extensions..js (module.js:579:10)
> at Module.load (module.js:487:32)
> at tryModuleLoad (module.js:446:12)
> at Function.Module._load (module.js:438:3)
> at Module.require (module.js:497:17)
> at require (internal/module.js:20:19)
> at Liftoff.handleArguments (C:UsersP.A.N.D.E.M.I.CAppDataRoamingnpmnode_modulesgulpbingulp.js:116:3)
有完整的gulpfile代码.js
var gulp = require('gulp');
var concatCss = require('gulp-concat-css');
var cleanCSS = require('gulp-clean-css');
var concat = require('gulp-concat');
var uglyfly = require('gulp-uglyfly');
var imagemin = require('gulp-imagemin');
var autoprefixer = require('gulp-autoprefixer');
var livereload = require('gulp-livereload');
gulp.task('css', function () {
return gulp.src('static/css/*.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(concatCss("styles/clean.min.css"))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('static/min_css/'));
.pipe(livereload());
});
gulp.task('js', function () {
return gulp.src('static/js/*.js')
.pipe(concat('all.js'))
.pipe(uglyfly())
.pipe(gulp.dest('static/min_js/'));
.pipe(livereload());
});
gulp.task('img', function () {
return gulp.src('static/img/*')
.pipe(imagemin())
.pipe(gulp.dest('static/img/'));
.pipe(livereload());
});
gulp.task('default', function() {
livereload.listen();
gulp.watch('static/css/*.css', ['css']);
gulp.watch('static/js/*.js', ['js']);
gulp.watch('static/img/*', ['img']);
});
您将在前面的行中结束语句:
.pipe(gulp.dest('static/min_css/'));
.pipe(livereload());