gpt4 book ai didi

css - 在响应式站点中使用 uncss 删除不需要的 css

转载 作者:太空宇宙 更新时间:2023-11-03 23:08:11 25 4
gpt4 key购买 nike

我有 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/

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