【问题标题】:How to set up autoprefixer.browsers value using docpad.coffee config?如何使用 docpad.coffee 配置设置 autoprefixer.browsers 值?
【发布时间】:2015-02-12 09:47:19
【问题描述】:

(已经找到以下所有设置信息真是一团糟:-/)

我可以让 autoprefixer 与 docpad 一起运行,但我(我猜我)没有成功设置 browsers 值...

我的环境:

  • docpad 6.69.1
  • IE 11、FF 31.0 + Firebug

到目前为止我尝试过的(使用插件安装docpad:jade、less、livereload、标记):

简单安装(默认browsers 设置):

  1. docpad install autoprefix

我得到了一些 style.css.less 文件,其中包含一些导入,尤其是一些 background: radial-gradient(...) ; background: linear-gradient(...) 规则。

  1. 我将我的 style.css.less 重命名为 style.css.autoprefix.css.lessstyle.css.autoprefix.less 不起作用)

到目前为止,它仅在警告less->csscss->autoprefix 转换没有做任何应该没问题的事情时起作用。

autoprefixer 在上面添加了我的...gradient... 规则的一些-webkit... 版本。

不能在没有 docpad stylus 插件的情况下设置 browsers

...在我看来...所以我继续这样:

  1. docpad install stylus
  2. 将自动前缀手写笔设置添加到我的docpad.coffee 设置文件中:

    docpadConfig = {
    
      #...
    
      plugins:
        stylus:
          stylusLibraries:
            'autoprefixer-stylus': true
          options:
            use: [
              #() -> require('autoprefixer-stylus')('ie 6')
              () -> require('autoprefixer-stylus')('ff > 3')
              #() -> require('autoprefixer-stylus')('last 2 versions')
            ]
    }
    
    # Export our DocPad Configuration
    module.exports = docpadConfig
    

效果是,现在我的style.css 显然又被自动添加前缀了,但是在上面的选项之间切换没有效果。

如何使browsers 设置从这里开始工作?

我从不同来源收集到的所有设置信息,所以我可能错过了一些东西。也许已经可以在没有 stylus 插件的情况下配置browsers 设置?

这里或多或少帮助我达到这一点的来源:

我的主要测试用例

在我的 css 中手动添加额外的 -moz-radial-gradient.../-moz-linear-gradient... 规则会显示正确的渐变。删除它们不会显示任何渐变(甚至不显示标准语法并且独立于使用自动前缀...这可能是一个无关/遗留问题,因为我希望更复杂的 style.css 改变上述browsers 选项至少逐渐改变。)

【问题讨论】:

    标签: coffeescript stylus docpad autoprefixer


    【解决方案1】:

    有效 - 问题出在其他地方!

    因此问题已经包含如何设置的答案 ...

    以下 gradient 相关问题让我检查了我的 gradient-syntax

    https://github.com/artpolikarpov/fotorama/issues/91

    并遵循规范:http://www.w3schools.com/css/css3_gradients.asp

    更彻底,因为改变

    background: linear-gradient( top,         red,  yellow);
    background: radial-gradient( top right,   red,  yellow);
    

    background: linear-gradient( to bottom left,                        red,  yellow )
    background: radial-gradient( ellipse farthest-corner at top right,  red,  yellow )
    

    它就像一个魅力:-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 2016-12-06
      • 2014-02-06
      • 2019-08-30
      • 2015-05-04
      相关资源
      最近更新 更多