2014-10-02 22 views
0

我有很多搜索,但我沒有找到解決方案。字體真棒錯誤:資源解釋爲字體,但與MIME類型文本/ html傳輸

我用發電機的角度來生成項目,並有字體真棒參與,但我得到了鍍鉻警告

Resource interpreted as Font but transferred with MIME type text/html: "http://gview.com/fonts/fontawesome-webfont.svg?v=4.2.0" 

我注意到有一些規則生成的.htaccess文件來處理字體MIME類型,我不知道爲什麼它不能爲我工作。

此外,我用ui.router的看法路線,並擺脫了#的目的,我在.htaccess添加一些規則如下:

RewriteEngine敘述上

# Don't rewrite files or directories 
    RewriteCond %{REQUEST_FILENAME} -f [OR] 
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule^- [L] 

    # Rewrite everything else to index.html to allow html5 state links 
    RewriteRule^index.html [L] 

我找不出錯在哪裏。

非常感謝。

回答

0

如果您使用Grunt爲您的應用程序提供服務,則可能需要做一些小改動以允許其他文件擴展名通過。

connect: { 
     options: { 
      port: 9000, 
      // Change this to '0.0.0.0' to access the server from outside. 
      hostname: 'localhost', 
      livereload: 35729 
     }, 
     livereload: { 
      options: { 
       open: true, 
       middleware: function (connect) { 
        return [ 
         modRewrite(['!\\.html|\\.js|\\.svg|\\.css|\\.png|\\.woff|\\.ttf|\\.gif$ /index.html [L]']), 

檢查您的Gruntfile中的modRewrite以確保您擁有所有需要的文件擴展名。

相關問題