2017-07-14 14 views
0

我使用ancgular-cli建立我的申請,在生產中有這樣的命令 -部署,網址字體Angualr-CLI

ng build --aot --target=production -e ${NG_ENV:-prod} --deploy-url ${NG_DEPLOY_URL:-https://app.contentsnare.com/} --output-path dist && find dist \\(-name '*.css' -o -name '*.js' \\) -exec gzip --keep --quiet --force {} \\; 

,這一切運作良好,但在glyphicons字體的連接有問題。 他們得到錯誤的路徑,錯誤看起來像這樣 - http://joxi.ru/a2XYkX6syDb01A,不明白爲什麼以及如何修復它。

我認爲這是因爲deploy-url,但不知道如何解決它。

回答

2

如果使用static.json部署,或nginx的,那麼你應該把這個給CONFIGS:

"headers": { 
    "*/glyphicons-halflings-regular.*": { 
    "Access-Control-Allow-Origin": "*" 
    } 
} 

例如,我用這個buildpack在Heroku上,我應該寫在static.json以下因爲它:

{ 
"root": "dist/", 
"https_only": true, 
"routes": { 
    "/**": "index.html" 
    }, 
    "headers": { 
    "*/glyphicons-halflings-regular.*": { 
     "Access-Control-Allow-Origin": "*" 
    } 
    } 
}