关于javascript:Gulp livereload SyntaxError:意外令牌。怎么修?

Gulp livereload SyntaxError: Unexpected token . how to fix?

当我运行gulp命令时,此错误被炸毁

如果您对如何解决此问题有任何想法,我已经准备好聆听))

如果您对如何解决此问题有任何想法,我已经准备好倾听))

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
> C:\\Users\\P.A.N.D.E.M.I.C\\Desktop\\try\\gulpfile.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:\\Users\\P.A.N.D.E.M.I.C\\AppData\
oaming\
pm\
ode_modules\\gulp\\bin\\gulp.js:116:3)

有gulpfile.js的完整代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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']);
});


您将在以下行的结尾处结束语句:

1
2
.pipe(gulp.dest('static/min_css/'));
.pipe(livereload());