【问题标题】:Why is uncss ignore not working right?为什么 uncss ignore 不能正常工作?
【发布时间】:2015-12-22 10:12:55
【问题描述】:

对于我的网站,我使用 uncss 来删除未使用的 bootstrap-css。但是有两个元素 - bootstrap carousel 幻灯片动画和一个 active-state 在我的导航中,在 uncss 生成新的 css 文件后无法正常工作。 p>

这是我的 uncss-ignore

ignore: [
    ".tab",
    ".tab-content",
    ".tab-pane",
    ".fade",
    ".fade.in",
    ".collapse",
    ".collapse.in",
    ".collapsing",
    ".open",
    "/open+/",
    ".start",
    ".start .container-shadow",
    ".active",
    ".embed-responsive-item",
    ".embed-responsive",
    ".embed-responsive-16by9",
    ".schmerzfrei iframe",
    ".embed-responsive .embed-responsive-item",
    ".embed-responsive embed",
    ".embed-responsive object",
    ".embed-responsive iframe",
    ".embed-responsive video",
    ".highlight a:hover:after, .highlight a:focus:after, .highlight.active a:after",
    ".carousel-inner > .next",
    ".carousel-inner > .prev",
    ".carousel-inner > .next",
    ".carousel-inner > .prev",
    ".carousel-inner > .next.left",
    ".carousel-inner > .prev.right",
    ".carousel-inner > .active.left",
    ".carousel-inner > .active.right",
    ".carousel-inner>.item.active",
    ".carousel-inner>.item.next.left",
    ".carousel-inner>.item.prev.right",
    ".bs.carousel",
    ".slid.bs.carousel",
    ".slide.bs.carousel"
]
}

这是我的 css,它是必要的,但未被 uncss 识别

.highlight a:hover:after, .highlight a:focus:after, .highlight.active a:after {
    height: 0px;
    -webkit-transition: .3s cubic-bezier(0.71, -0.58, 0.07, 1.29);
    -moz-transition: .3s cubic-bezier(0.71, -0.58, 0.07, 1.29);
    -ms-transition: .3s cubic-bezier(0.71, -0.58, 0.07, 1.29);
    -o-transition: .3s cubic-bezier(0.71, -0.58, 0.07, 1.29);
    transition: .3s cubic-bezier(0.71, -0.58, 0.07, 1.29)
}

任何评论或帮助都会很棒!

【问题讨论】:

    标签: gruntjs uncss


    【解决方案1】:

    根据https://github.com/giakki/uncss/issues/140,uncss 不会剥离带有伪元素的选择器,因此不需要在忽略列表中指定所有这些,并且大概将它们放入忽略列表也不会做任何事情。

    你可以试试替换

    ".highlight a:hover:after, .highlight a:focus:after, .highlight.active a:after"

    new RegExp('^.highlight.*')

    这应该与您的选择器匹配,并且更易于阅读。

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 2019-01-04
      • 2020-09-03
      • 2016-10-10
      • 2016-10-24
      • 2017-02-27
      • 2017-07-08
      • 2014-11-23
      • 2021-03-07
      相关资源
      最近更新 更多