如果我用 gulp-ruby-sass 编译 scss,gulp-autoprefixer 可以工作,但是如果用 gulp-compass autoprefixer 编译 de scss 则不起作用。这是代码:
gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
livereload = require('gulp-livereload'),
prefix = require('gulp-autoprefixer'),
compass = require('gulp-compass');
// Styles .scss files to .css
gulp.task('style', function(){
return sass('src/sass/style.scss', {
style: 'expanded'
})
.on('error', sass.logError)
.pipe(prefix('last 2 version'))
.pipe(gulp.dest('dist/'))
.pipe(livereload());
});
// Compass to .css
gulp.task('compass', function(){
gulp.src('src/sass/*.sass')
.pipe(compass({
config_file: './config.rb',
css: 'dist/',
sass: 'src/sass',
style: 'expanded'
}))
.pipe(prefix('last 2 versions'))
.pipe(gulp.dest('dist/'))
.pipe(livereload());
});
// Watch with compass
gulp.task('watch', function(){
livereload.listen();
gulp.watch('src/sass/*.scss', ['compass']);
});
// Watch with ruby-sass
gulp.task('watch2', function(){
livereload.listen();
gulp.watch('src/sass/*.scss', ['style']);
});
watch任务有效,watch2任务编译 scss,但 autoprefixer 不起作用。