我有 uncss(github 上的一个元素)来删除响应式网站不需要的 css。 它还会删除 mobile.css 文件中提到的 css,但它实际上会影响移动 View 中的站点。我不知道 uncss 是如何工作的? 也就是说,它只是简单地删除了 DOM 中不存在的选择器,或者仅删除了特定视口(viewport)中未使用的选择器。
最佳答案
媒体选项是营救:
选项 = {
...
media : ['(min-width: 700px) handheld and (orientation: landscape)'],
...
}
来自文档:
media (Array): By default UnCSS processes only stylesheets with media query "all", "screen", and those without one. Specify here which others to include.
只需为 mobile.css 指定准确的 meida 选项并享受适当的 unCSS 工作。
关于css - 在响应式站点中使用 uncss 删除不需要的 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33938054/