我有一個奇怪的錯誤,其中找到了一些字體,但有些字體沒有找到。基本上我有兩種字體font1
(IconMoon的自定義字體)和Brandon
(來自fonts.com)。我的目錄結構是Rails資產管道:未找到字體
- app
- assets
- fonts
- font1.eot
- ...
- 172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot
- ...
我使用SCSS加載我的字體:
@font-face {
font-family: 'font1';
src:font-url('font1.eot?-kpzpl9');
src:font-url('font1.eot?#iefix-kpzpl9') format('embedded-opentype'),
font-url('font1.woff?-kpzpl9') format('woff'),
font-url('font1.ttf?-kpzpl9') format('truetype'),
font-url('font1.svg?-kpzpl9#font1') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face{
font-family:'Brandon Grot W01 Medium';
src:font-url('172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot?#iefix');
src:font-url('172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot?#iefix') format('eot'),
font-path('50ca6f6f-b64d-4af0-9b30-526cf363d87e.woff2') format('woff2'),
font-url('050c2cbf-b818-4b8e-b6d2-71b70478bd9d.woff') format('woff'),
font-url('7da41ce3-b3fd-4fca-a85f-4f3099884c15.ttf') format('truetype'),
font-url('37c88f3d-9532-4547-9e11-7cca7f66048c.svg#37c88f3d-9532-4547-9e11-7cca7f66048c') format('svg');
}
當我嘗試加載font1
字體,一切正常。但是當我嘗試加載Brandon
字體時,我收到404錯誤。這是生成的CSS:
@font-face {
font-family: 'font1';
src: url(/assets/font1.eot?-kpzpl9);
src: url(/assets/font1.eot?#iefix-kpzpl9) format("embedded-opentype"), url(/assets/font1.woff?-kpzpl9) format("woff"), url(/assets/font1.ttf?-kpzpl9) format("truetype"), url(/assets/font1.svg?-kpzpl9#font1) format("svg");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Brandon Grot W01 Medium';
src: url(/assets/172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot?#iefix);
src: url(/assets/172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot?#iefix) format("eot"), "/assets/50ca6f6f-b64d-4af0-9b30-526cf363d87e.woff2" format("woff2"), url(/assets/050c2cbf-b818-4b8e-b6d2-71b70478bd9d.woff) format("woff"), url(/assets/7da41ce3-b3fd-4fca-a85f-4f3099884c15.ttf) format("truetype"), url(/assets/37c88f3d-9532-4547-9e11-7cca7f66048c.svg#37c88f3d-9532-4547-9e11-7cca7f66048c) format("svg");
}
呼叫至/assets/font1.eot
導致200
,並呼籲/assets/172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot
導致404
。
我不知道爲什麼會發生這種情況,因爲它們在同一個目錄中。日誌看起來是這樣
Started GET "/assets/font1.eot" for 127.0.0.1 at 2016-02-05 10:38:22 +0100
Served asset /font1.eot - 304 Not Modified (0ms)
Started GET "/assets/172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot" for 127.0.0.1 at 2016-02-05 10:39:25 +0100
Served asset /172fdde2-f56b-433a-a6e2-ebeab9dfb588.eot - 404 Not Found (6ms)
我on Rails的3.2.9
如何調試這個問題的任何想法?
你在本地預編譯了嗎? –
你確定你的字體家族是'172fdde2-f56b-433a-a6e2-ebeab9dfb588'的名字? –
不,我沒有在本地預編譯 – 23tux