Gulp.js启动sass任务,但未完成

时间:2019-02-19 15:30:28

标签: sass gulp gulp-sass node-sass

我的gulp.js看起来像这样:

var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    sass = require('gulp-sass'),
    sourcemaps = require('gulp-sourcemaps'),
    webserver = require('gulp-webserver');

gulp.task('js', function() {
  return gulp.src('builds/sassEssentials/js/myscript.js')
    .pipe(jshint('./.jshintrc'))
    .pipe(jshint.reporter('jshint-stylish'));
});

gulp.task('sass', function () {
    return sass('process/sass/style.scss', {
      sourcemap: true,
      style: 'compressed'
    })
    .on('error', function (err) {
        console.error('Error!', err.message);
    })
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('builds/sassEssentials/css'));
});

gulp.task('watch', function() {
  gulp.watch('builds/sassEssentials/js/\**/*', ['js']);
  gulp.watch(['process/sass/**/*'], ['sass']);
});

gulp.task('webserver', function() {
    gulp.src('builds/sassEssentials/')
        .pipe(webserver({
            livereload: true,
            open: true
        }));
});

我已经检查了此answer

但是我仍然不知道是什么问题。

运行gulp命令之后。输出如下。

[16:16:33] Using gulpfile ~\PycharmProjects\sassEssentials\gulpfile.js
[16:16:33] Starting 'sass'...
[16:16:33] Starting 'watch'...
[16:16:33] Finished 'watch' after 248 ms
[16:16:33] Starting 'webserver'...
[16:16:33] Webserver started at http://localhost:8000
[16:16:33] Finished 'webserver' after 36 ms

有人可以帮我找出问题所在吗?

0 个答案:

没有答案