【问题标题】:uncss, regex pattern for .no-'string', .is-'string'uncss,.no-'string'、.is-'string' 的正则表达式模式
【发布时间】:2016-04-01 13:53:44
【问题描述】:

我遇到了一些正则表达式问题。

使用 gulp-uncss

我想在忽略选项中添加一些类。

任何以.no-开头的类

任何包含 .is- 的类

.no-flexbox {}
.test.is-active {}
.test .is-hidden {}


.pipe(uncss({
    html: ['tmp/public_html/*.html'],
    ignore: ['/(.is-)(\w)*', '(.no-)(\w)*']
}))

这不太对

【问题讨论】:

    标签: javascript regex uncss gulp-uncss


    【解决方案1】:

    您的正则表达式看起来不完整。也许你应该这样做

    .pipe(uncss({
        html: ['tmp/public_html/*.html'],
        ignore: ['/\.no-\w+/g', '/\.\w+\s?\.is-\w+/g']
    }))
    

    【讨论】:

    • 完美...刚刚删除了周围的撇号,然后boooom...非常感谢
    • 是的,删除周围的撇号使上面的代码 sn-p 工作。
    猜你喜欢
    • 2014-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-07
    • 2018-05-17
    • 2014-05-03
    • 1970-01-01
    相关资源
    最近更新 更多