Css 在Meteor中使用@import

Css 在Meteor中使用@import,css,meteor,Css,Meteor,我在Meteor应用程序的样式表顶部使用css@import。表示at规则“必须优先于所有其他类型的规则”。在开发过程中,这与预期一样有效,从谷歌获得了字体。然而,在生产中,Meteor最小化并连接了所有css,将我的@import文件保留了一半。我很确定这就是我(从Firefox控制台)得到的这个错误的原因: 万一这不是问题所在,我想是的,规则如下: @import url("http://fonts.googleapis.com/css?family=Lato:400,700,900,400

我在Meteor应用程序的样式表顶部使用css
@import
。表示at规则“必须优先于所有其他类型的规则”。在开发过程中,这与预期一样有效,从谷歌获得了字体。然而,在生产中,Meteor最小化并连接了所有css,将我的
@import
文件保留了一半。我很确定这就是我(从Firefox控制台)得到的这个错误的原因:

万一这不是问题所在,我想是的,规则如下:

@import url("http://fonts.googleapis.com/css?family=Lato:400,700,900,400italic");

以前有人遇到过这个问题并找到了解决方案吗?我是否遗漏了一些明显的内容?

编辑:现在已修复并合并


先前的答复:

这是一个很好的例子。 您可能需要尝试另一种加载字体的方法。使用另一个CSS文件或使用google提供的javascript代码段:

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Lato:400,700,900,400italic:latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); 
</script>

WebFontConfig={
谷歌:{families:['Lato:400700900400Italic:latin']}
};
(功能(){
var wf=document.createElement('script');
wf.src=('https:'==document.location.protocol?'https':'http')+
“://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js”;
wf.type='text/javascript';
wf.async='true';
var s=document.getElementsByTagName('script')[0];
s、 parentNode.insertBefore(wf,s);
})(); 

编辑:现在已修复并合并


先前的答复:

这是一个很好的例子。 您可能需要尝试另一种加载字体的方法。使用另一个CSS文件或使用google提供的javascript代码段:

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Lato:400,700,900,400italic:latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); 
</script>

WebFontConfig={
谷歌:{families:['Lato:400700900400Italic:latin']}
};
(功能(){
var wf=document.createElement('script');
wf.src=('https:'==document.location.protocol?'https':'http')+
“://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js”;
wf.type='text/javascript';
wf.async='true';
var s=document.getElementsByTagName('script')[0];
s、 parentNode.insertBefore(wf,s);
})(); 

您到底在哪里插入此内容?似乎已根据我链接到的问题的评论进行了更正。但要回答您的问题,您需要将该脚本放在HTML文件(或布局模板)的头部。如果你能测试它是否被更正并分享回来,我可以相应地更新我的答案。你到底在哪里插入这个?它似乎是根据我链接到的问题上的评论更正的。但要回答您的问题,您需要将该脚本放在HTML文件(或布局模板)的头部。如果你能测试它是否被更正并分享回来,我可以相应地更新我的答案。