5

We're using cassette bundling for our mvc project. We ran into an issue that when we push our site to our dev server, certain font files aren't making their way into cassette.axd. The resulting stylesheet shows a link to the font file in cassette.axd but when trying to pull up the actual url we get a 404. So rather than having the fonts included I'm trying to see if we can exclude the font folder from cassette's minification. The structure is..

Root
  |Content
    |css
      |styles.css
    |font

The styles.css has the following in it...

@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;
}

In the resulting styles.css from cassette the references to the fonts are something like...

src: url('/newdesign/cassette.axd/file/Content/font/lato-regular-webfont-5daaab4d79c85c0ac9f932c4848f08f673f3e6c4.eot'

Is there a way that we can exclude the font folder so that the src in the css file continues to point to the font folder instead of the cassette result?

4

1 回答 1

3

找到了答案,至少它在 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>
于 2013-10-10T19:03:04.117 回答