【问题标题】:2 calls of a mixin less function with different parameters, have the same result2次调用具有不同参数的mixinless函数,结果相同
【发布时间】:2012-04-26 03:09:23
【问题描述】:

我用不同的参数调用了一个 mixinless 函数两次,但结果是相同的,并且是由第一个参数创建的。有一个例子:

输入:

.font-face (@fontName, @fontFileName)
{
    @font-face {
        font-family: @fontName;
        src: url("../../fonts/@{fontFileName}.eot");
        src: url("../../fonts/@{fontFileName}.eot?#iefix") format("embedded-opentype"),
             url("../../fonts/@{fontFileName}.woff") format("woff"),
             url("../../fonts/@{fontFileName}.ttf") format("truetype");
        font-weight: normal;
        font-style: normal;
    }
}

.font-face ("BMitra", "BMitra");
.font-face ("BMitraBold", "BMitraBold");

输出:

@font-face {
  font-family: "BMitra";
  src: url("../../fonts/BMitra.eot");
  src: url("../../fonts/BMitra.eot?#iefix") format("embedded-opentype"), url("../../fonts/BMitra.woff") format("woff"), url("../../fonts/BMitra.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "BMitra";
  src: url("../../fonts/BMitra.eot");
  src: url("../../fonts/BMitra.eot?#iefix") format("embedded-opentype"), url("../../fonts/BMitra.woff") format("woff"), url("../../fonts/BMitra.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

有什么问题? 我在 ASP .Net MVC 3.0 应用程序中使用 dotless。

【问题讨论】:

    标签: asp.net-mvc less dotless


    【解决方案1】:

    @media 和@font-face 在当前版本中同时被less.js 和dotless 支持。

    但是,通过 mixin 放入 @font-face 块是相对较新的领域 - 看起来像是一个错误。

    [编辑]

    已经有一个bug for less.js 有一个work-around

    [编辑 2]

    这个问题现在在 dotless main 中得到修复。

    【讨论】:

      【解决方案2】:

      坏消息:@media and @font-face support in LessCSS。 LESS CSS 还没有真正支持'@font-face' :(

      【讨论】:

      • OK :( 。我为每种字体创建了一个没有任何参数的函数,现在结果是正确的。例如:.fontMitra { @font-face { font-family: BMitra; src: url( "../../fonts/BMitra.eot"); src: url("../../fonts/BMitra.eot?#iefix") 格式("embedded-opentype"), url(".. /../fonts/BMitra.woff") 格式("woff"), url("../../fonts/BMitra.ttf") 格式("truetype"); 字体粗细:正常;字体样式: 正常; } }
      • 那个线程很老了..我们做了很多改进,@font-face 现在应该可以正常工作了..
      • 亲爱的 Tigraine,我用的是你的最新版本。你有其他使用@font-face 的解决方案吗?
      • 查看 Luke Page 的回复
      猜你喜欢
      • 2018-07-02
      • 1970-01-01
      • 2014-03-24
      • 2012-06-24
      • 2015-06-09
      • 1970-01-01
      • 2015-04-09
      • 2011-12-26
      相关资源
      最近更新 更多