问题描述
我有uncss(github上的一个项目),为响应式网站删除不需要的CSS。
它还会删除mobile.css文件中提到的css,但实际上会在移动视图中影响网站。我不知道uncss是如何工作的?
即天气,它只是删除DOM中不存在的选择器,或者它删除仅在特定视图端口中未使用的选择器。
媒体选项是为了拯救:
options = {
...
media :['(min-width:700px)handheld and(orientation:landscape)'],
...
}
从文档:
只需为mobile.css指定准确的meida选项并享受适当的unCSS工作即可。
I have uncss (A project on github) to remove unwanted css for responsive site .It also removes the css mentioned in the mobile.css file , but which actually affects the site in mobile view . I don't have any idea how the uncss works ?i.e weather it simply removes the selectors which are not present in DOM or it removes the selectors which are not used in a particular view port only .
Media option is to rescue:
options = { ... media : ['(min-width: 700px) handheld and (orientation: landscape)'], ...}
From documentation:
Just specify exact meida option for mobile.css and exjoy proper unCSS work.
这篇关于删除不需要的CSS在响应式网站中使用uncss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!