Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Grunt Uncss Ignore函数中包含@media_Javascript_Css_Node.js_Json_Gruntjs - Fatal编程技术网

Javascript 如何在Grunt Uncss Ignore函数中包含@media

Javascript 如何在Grunt Uncss Ignore函数中包含@media,javascript,css,node.js,json,gruntjs,Javascript,Css,Node.js,Json,Gruntjs,我正在使用Grunt删除页面上未使用的CSS。 一切都很好,但不幸的是有时会有一些 代码片段会被删除,尽管这对网站至关重要 我希望Grunt忽略所有@媒体(最小宽度:…)CSS规则, 但我不知道如何在我的grunfile.JS中表达这一点 例如: 样式。css @media (min-width: 1025px) { .col2-set { width: 62.2% !important; float: left; margin-top: 45px; padd

我正在使用Grunt删除页面上未使用的CSS。 一切都很好,但不幸的是有时会有一些 代码片段会被删除,尽管这对网站至关重要

我希望Grunt忽略所有
@媒体(最小宽度:…)
CSS规则, 但我不知道如何在我的
grunfile.JS
中表达这一点

例如:

样式。css

@media (min-width: 1025px) {
  .col2-set {
    width: 62.2% !important;
    float: left;
    margin-top: 45px;
    padding: 0 90px 0 10px; }
  #order_review {
    width: 37.8%;
    float: right;
    margin-top: 45px; } }
uncss: {
        dist: {
        options: {
            ignore       : [
                          /expanded/,
                          /js/,
                          /wp-/,
                          /align/,
                          /admin-bar/,
                          /\w\.in/,
                          /.*footer.*/,
                          /.*footer*/,
                          "^meta\..*",
                          "^\.is-.*",
                          "/^#js/",
                          ".fade",
                          ".nav",
                          ".collapse",
                          ".collapsing"                            
                          ],
这可能很简单,但我仍然没有找到解决方案。 谁能给我一个提示吗

非常感谢

grunfile.js

@media (min-width: 1025px) {
  .col2-set {
    width: 62.2% !important;
    float: left;
    margin-top: 45px;
    padding: 0 90px 0 10px; }
  #order_review {
    width: 37.8%;
    float: right;
    margin-top: 45px; } }
uncss: {
        dist: {
        options: {
            ignore       : [
                          /expanded/,
                          /js/,
                          /wp-/,
                          /align/,
                          /admin-bar/,
                          /\w\.in/,
                          /.*footer.*/,
                          /.*footer*/,
                          "^meta\..*",
                          "^\.is-.*",
                          "/^#js/",
                          ".fade",
                          ".nav",
                          ".collapse",
                          ".collapsing"                            
                          ],

将注释:
/*uncss:ignore start*/
添加到styles.css文件中的
@media…
查询前一行,并将结束注释
/*uncss:ignore end*/
添加到
@media
查询结束后的下一行

这两条评论之间的任何规则都将被忽略

样式示例。css:

/*uncss:忽略启动*/
@介质(最小宽度:1025px){
.col2套{
宽度:62.2%!重要;
浮动:左;
边缘顶部:45像素;
填充:0 90px 0 10px;
}
#订单审核{
宽度:37.8%;
浮动:对;
边缘顶部:45像素;
}
}
/*uncss:忽略结束*/