My gulp configuration for gulp-uncss is
gulp.task('uncssme', function () {
return gulp.src('src/css/**/*.css')
.pipe(uncss({
html: ['src/**/*.html']
}))
.pipe(gulp.dest('dist/css'))
});
Using uncss removes 'newClass' selector from final css files because that class in not directly used in .html file but added dynamically through js.
document.getElementById('good').className += ' newClass';
EDIT: I am already using /* uncss:ignore */ to make it work but this doesn't make sense to add this comment everytime for a class present in .js but not in .html
Maybe, you can prefix every class using only in js widh
is-
and add ignore option with a regex in gulp task.