【问题标题】:HTML comments causing an issue exporting CSS files with Grunt-useminHTML 注释导致使用 Grunt-usemin 导出 CSS 文件时出现问题
【发布时间】:2013-11-08 16:01:21
【问题描述】:

我正在使用 yeoman/grunt 进行构建过程,但遇到了问题。我正在尝试构建两个 .css 文件,一个用于 IE8,一个用于其他所有文件。如果我将 IE 条件放置在构建块的外部,则会由于注释中的注释而引发错误。如果我将 IE 条件放在里面,它就会被剥离。

    <!--[if lte IE 8]>
    <!-- build:css({.tmp,app}) styles/main-old-ie.css -->
        <link rel="stylesheet" href="styles/main-old-ie.css">
    <!-- endbuild -->
    <![endif]-->

    <!--[if gt IE 8]><!-->
    <!-- build:css({.tmp,app}) styles/main.css -->
    <link rel="stylesheet" href="styles/main.css">
    <!-- endbuild -->
    <!--<![endif]-->

还有其他/更好/更简单的方法吗?

谢谢!

【问题讨论】:

  • 您使用的是哪个版本的 grunt-usemin?
  • 0.1.12。 2.0 解决了这个问题吗?
  • 是的。你应该升级。

标签: html gruntjs yeoman grunt-usemin


【解决方案1】:

升级到 v2.0。对于那个功能。

【讨论】:

  • 谢谢。看起来 2.0 在我问这个问题之前就已经发布了,应该先检查一下。
  • 运行 2.0.2 仍然失败,因为 &lt;!--&gt; 已被剥离,非 ie 浏览器需要 - 否则不会加载任何样式。
  • @nav 我看到你对github.com/yeoman/grunt-usemin/issues/263 发表了评论 - 你的区块中有多个条件吗?
  • @Scottux 不只是&lt;!--[if gt IE 8]&gt;&lt;!--&gt;
猜你喜欢
  • 2014-04-12
  • 1970-01-01
  • 2012-10-25
  • 2013-08-25
  • 1970-01-01
  • 1970-01-01
  • 2023-04-04
  • 2016-07-30
  • 1970-01-01
相关资源
最近更新 更多