使用早午餐作为前端原型的构建工具,我在设置UnCSS-plugin时遇到了困难。为了快速安装,我安装了自举4-skeleton,除了UnCSS之外,一切都很顺利。
我在brunch build --production上遇到的错误是error: UnCSS: no stylesheets found。我将插件配置如下:
plugins:
sass:
options:
includePaths: [
'bower_components/bootstrap/scss'
]
postcss:
processors: [
require('autoprefixer')
]
babel:
ignore: [
/^(bower_components|vendor)/
]
uncss:
options:
csspath: 'css/app.css'
htmlroot: 'public'
files: ['index.html']该项目的源文件位于app中:app/assets中的index.html、app/stylesheets中的main.scss (导入引导)和styles.css以及app/javascripts中的app.js。
早午餐将其构建到一个名为public的文件夹中,其中样式为public/css/app.css,内容为public/index.html。问题是,UnCSS的配置有哪些不正确?我对它的理解是,它适用于来自构建的CSS输出,在这种情况下,路径似乎是正确的。
2014年的对此的一个问题也提出了同样的要求,但一直没有得到回应。
发布于 2016-02-13 13:37:27
我没有考虑过看GitHub问题,其中其中一个专门解决了这一问题。本质上,正如@1951FDG所建议的
plugins:
uncss:
options:
ignore: [/\.\bactive\b/]
ignoreSheets: [/fonts.googleapis/]
files: ['public/index.html']忽略:示例正则表达式忽略'.active‘类 ignoreSheets:忽略Google字体的示例regex
更重要的是,这种对UnCSS的调用读取index.html中链接的样式表以找到正确的CSS-文件,然后对其进行处理。
https://stackoverflow.com/questions/35380362
复制相似问题