1

我对 Gulp unCSS 任务有疑问。问题是该任务正在删除引导 css 类(那些出现在 JS 事件之后的类,例如折叠、显示、折叠、折叠等)。

我知道我可以将每个类作为数组放在忽略选项中,但是我需要了解所有需要的类。

有没有更好的方法来解决这个问题?

也许我应该忽略每个使用 JS 的 Bootstrap SASS 部分?

如果有人能给我一些提示我应该如何解决这个问题,我会很感激。

这就是我包含引导 scss 部分的方式:

@import url('https://fonts.googleapis.com/css? 
family=Lato:300,400,700');
@import url('https://fonts.googleapis.com/css? 
family=Martel+Sans:300,400,700');

@import 'utils/variables';

@import "../../node_modules/bootstrap/scss/functions";
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/mixins";
@import '../../node_modules/bootstrap/scss/reboot';
@import '../../node_modules/bootstrap/scss/root';
@import '../../node_modules/bootstrap/scss/type';
@import '../../node_modules/bootstrap/scss/utilities';
@import '../../node_modules/bootstrap/scss/transitions';
@import '../../node_modules/bootstrap/scss/grid';
@import '../../node_modules/bootstrap/scss/pagination';
@import '../../node_modules/bootstrap/scss/nav';
@import '../../node_modules/bootstrap/scss/navbar';
@import '../../node_modules/bootstrap/scss/dropdown';
@import '../../node_modules/bootstrap/scss/carousel';

@import '../../node_modules/font-awesome/scss/font-awesome';

这是我的 Gulp UNCSS 任务(但这不是最佳方法......)

gulp.task('uncss', function () {
 return gulp.src([
'app/css/app.css'
 ])
.pipe(uncss({
  html: [
    'app/**/*.html'
  ],
  ignore: [
    /\.fade/,
    /\.collapse/,
    /\.collapsed/,
    /\.fade-out/,
    /\.show/
  ]
}))
.pipe(gulp.dest('app/css/'));
});

谢谢!

4

0 回答 0