0

I included gulp-uncss:

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

Then I added its function to the styles task:

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}));
});

But, it's not working because the index.html hasn't been generated yet.

Given yeoman generator gulp-webapp's gulpfile, how is it possible to make uncss process the main.css file upon build?

scottrod
  • 477
  • 1
  • 8
  • 21
  • I tried adding ` .pipe(uncss({ html: ['src/**/*.html'] }))` to line 55 of styles.js but it stripped most of my styles away – Benny Powers Apr 07 '16 at 07:39
  • also tried `.pipe(uncss({html:'src/app/**/*.html'}))` at build.js:54 (which is ostensibly the correct place for it) and it stripped all my styles – Benny Powers Apr 07 '16 at 08:11

0 Answers0