我们正在为我们的mvc项目使用卡带捆绑.我们遇到了一个问题,当我们将我们的网站推送到我们的开发服务器时,某些字体文件没有进入cassette.axd.生成的样式表显示了一个指向cassette.axd中字体文件的链接,但是当我尝试拉出实际的url时,我们得到了404.所以不是要包含字体我试图看看我们是否可以从盒式磁带中排除字体文件夹缩小.结构是......
Root
|Content
|css
|styles.css
|font
Run Code Online (Sandbox Code Playgroud)
styles.css中有以下内容......
@font-face {
font-family: 'latolight_italic';
src: url('../font/lato-lightitalic-webfont.eot');
src: url('../font/lato-lightitalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/lato-lightitalic-webfont.woff') format('woff'),
url('../font/lato-lightitalic-webfont.ttf') format('truetype'),
url('../font/lato-lightitalic-webfont.svg#latolight_italic') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'latoregular';
src: url('../font/lato-regular-webfont.eot');
src: url('../font/lato-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/lato-regular-webfont.woff') format('woff'),
url('../font/lato-regular-webfont.ttf') format('truetype'),
url('../font/lato-regular-webfont.svg#latoregular') format('svg');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
在盒式磁带中产生的styles.css中,对字体的引用就像...
src:url('/ newdesign/cassette.axd/file/Content/font/lato-regular-webfont-5daaab4d79c85c0ac9f932c4848f08f673f3e6c4.eot'
有没有办法我们可以排除字体文件夹,以便css文件中的src继续指向字体文件夹而不是卡带结果?
找到了答案,至少它在 Google Groups 上为我解决了这个问题。将其添加到 Web.config 中:
<staticContent>
<remove fileExtension=".eot" />
<remove fileExtension=".otf" />
<remove fileExtension=".svg" />
<remove fileExtension=".ttf" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".otf" mimeType="application/x-font-opentype" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".ttf" mimeType="application/x-font-truetype" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
Run Code Online (Sandbox Code Playgroud)