gpt4 book ai didi

angularjs - Uncss 忽略选项不起作用

转载 作者:行者123 更新时间:2023-12-02 23:50:39 26 4
gpt4 key购买 nike

我正在尝试使用 uncss 删除 css但它会删除所有样式,无论它们是否列在 ignore 数组中。

我想要比较的 2 个文件只是索引和 app.min.js,其中包含作为字符串嵌入 javascript 中的所有模板,这些模板是使用 $templateCache 配置的。

看看 grunt 任务,也许我遗漏了一些明显的东西:

uncss:{
production: {
options: {
ignore: ['.someclass', '.someclass', '.someclass','.etc_etc_class'],
stylesheets:['app.min.css']
},
files: {
'dist/app.min.css':['dist/index.html','dist/app.min.js']
}
}
}

欢迎任何评论!

最佳答案

样式表选项应该具有相对于根目录的 css 文件的完整路径。因此,如果文件位于 dist/中,请将其添加到样式表选项中。

例如:

uncss: {
dist: {
options: {
ignore : ['#added_at_runtime', /test\-[0-9]+/],
media : ['(min-width: 700px) handheld and (orientation: landscape)'],
raw : 'h1 { color: green }',
stylesheets : ['lib/bootstrap/dist/css/bootstrap.css', 'src/public/css/main.css'],
ignoreSheets : [/fonts.googleapis/],
urls : ['http://localhost:3000/mypage', '...'], // Deprecated
timeout : 1000,
htmlroot : 'public',
report : 'min'
},
files: {
'dist/css/tidy.css': ['app/index.html', 'app/about.html']
}
}
}

参见:https://github.com/addyosmani/grunt-uncss

关于angularjs - Uncss 忽略选项不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27513413/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com