如何将gulp-uncss与yeoman发电机gulp-webapp结合起来

时间:2015-11-19 02:34:09

标签: gulp yeoman-generator gulp-uncss

我收录了gulp-uncss:

var uncss = require('gulp-uncss');

然后我将其功能添加到styles任务:

gulp.task('styles', () => {
return gulp.src('app/styles/*.scss')
.pipe($.plumber())
.pipe($.sourcemaps.init())
.pipe($.sass.sync({
  outputStyle: 'expanded',
  precision: 10,
  includePaths: ['.']
}).on('error', $.sass.logError))
.pipe($.autoprefixer({browsers: ['last 1 version']}))
.pipe($.sourcemaps.write())
.pipe(uncss({
        html: ['dist/index.html']
    }))
.pipe(gulp.dest('.tmp/styles'))
.pipe(reload({stream: true}));
});

但是,它不起作用,因为尚未生成index.html

鉴于yeoman生成器gulp-webapp的gulpfile,如何在构建时对main.css文件进行unss处理?

0 个答案:

没有答案