过去几个月我一直在使用相同的gulp文件处理项目。然而,当我编译一些CSS时,gulp任务只是悬挂而不是编译SASS。我不知道发生了什么事,因为文件在停止工作时甚至没有打开Gulp文件在下面,任何帮助都会很棒。
var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var debug = require('gulp-debug');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
function onError(err) {
console.log(err);
console.log(sourcemaps);
}
var config = {
bootstrapDir: './bower_components/bootstrap-sass',
publicDir: './css',
};
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
//Auto Prefixer
gulp.task('css', function() {
return gulp.src('./css/app.scss')
.pipe(sass({
includePaths: [config.bootstrapDir + '/assets/stylesheets'],
}))
.pipe(gulp.dest(config.publicDir + '/css'));
});
gulp.task('fonts', function() {
return gulp.src(config.bootstrapDir + '/assets/fonts/**/*')
.pipe(gulp.dest(config.publicDir + '/fonts'));
});
gulp.task('default', ['css', 'fonts', 'sass', 'prefixer'], function() {
});
gulp.task('sass', function(){
return gulp.src('./sass/app.scss')
.pipe(debug())
.pipe(sass({includePaths: ['./bower_components/bootstrap-sass/assets/stylesheets']}))
.pipe(gulp.dest('./css/'));
// .pipe(livereload({ start: true }));
});
gulp.task('prefixer', ['css', 'fonts', 'sass'], function () {
return gulp.src('./css/app.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('./css/'));
console.log('prefixer');
});
gulp.watch('sass/_partials/**/*.scss', function () {
console.log('Gulping...');
gulp.start('sass');
gulp.start('prefixer');
console.log('Done!');
// livereload.listen();
});
gulp.task('default', function() {
return gutil.log('Gulp is running!')
});
目前的回应是:
[15:18:58] Finished 'css' after 3.58 ms
[15:18:58] gulp-debug: sass/app.scss
[15:18:58] gulp-debug: 1 item
[15:18:58] Finished 'fonts' after 10 ms
[15:18:59] Finished 'sass' after 323 ms
[15:18:59] Starting 'prefixer'...
[15:18:59] Finished 'prefixer' after 298 ms
我认为这与手表功能无法正常工作有关,但不确定