magnars / optimus

A Ring middleware for frontend performance optimization.
364 stars 23 forks source link

FileNotFoundException #59

Closed kendagriff closed 6 years ago

kendagriff commented 7 years ago

Sorry to pester you for a second time in a week. I suspect there's something wrong in my configuration:

java.io.FileNotFoundException: /teachbanzai/fonts/FiraSans-Extralight.eot
 at optimus.assets.creation$existing_resource.invokeStatic (creation.clj:25)
    optimus.assets.creation$existing_resource.invoke (creation.clj:24)
    optimus.assets.creation$create_binary_asset.invokeStatic (creation.clj:54)
    optimus.assets.creation$create_binary_asset.invoke (creation.clj:52)
    optimus.assets.creation$eval1967$fn__1968.invoke (creation.clj:68)
    clojure.lang.MultiFn.invoke (MultiFn.java:233)
    optimus.assets.creation$load_asset_and_refs.invokeStatic (creation.clj:71)
    optimus.assets.creation$load_asset_and_refs.invoke (creation.clj:70)
    optimus.assets.creation$load_asset_and_refs$fn__1972.invoke (creation.clj:72)

The error is thrown in the build process, and it happens when I incorporate a CSS file as a bundle:

(load-bundles "public" {"style.css" ["/teachbanzai/css/style.css"]})

The font file is indeed there, and when style.css is used without optimus, the font file is found normally. Any thoughts?

magnars commented 7 years ago

That is weird. Could you try using relative URLs and see if that fixes things? (ie. ../fonts/FiraSans-Extralight.eot instead of /teachbanzai/fonts/FiraSans-Extralight.eot.

kendagriff commented 7 years ago

Strange... returns the exact same error. I should have mentioned, this isn't actually the app's deployment when it happens, it's an error coming from our continuous delivery server as it runs our test suite. Is that part of the mystery, perhaps?

magnars commented 7 years ago

Quite possibly, but I can't conjure a possible explanation at this point. Does it work in dev? In prod? How are you referencing the font-file in the CSS?

kendagriff commented 7 years ago
@font-face {
  font-family: 'Fira Sans';
  font-weight: 200;
  src: url("../fonts/FiraSans-Extralight.eot");
  /* IE9 Compat Modes */
  src: url("../fonts/FiraSans-Extralight.eot?#iefix") format("embedded-opentype"), url("../fonts/FiraSans-Extralight.woff2") format("woff2"), url("../fonts/FiraSans-Extralight.woff") format("woff");
}

The CSS is located at ./public/teachbanzai/css/style.css and the fonts are in ./public/teachbanzai/fonts.

I'll see if there isn't a way to replicate it outside my CI environment...

magnars commented 7 years ago

Yeah, that looks just like mine. One example:

@font-face{
  font-family:'FontAwesome';
  src:url('../font/fontawesome-webfont.eot');
  src:url('../font/fontawesome-webfont.eot') format('embedded-opentype'),url('../font/fontawesome-webfont.woff') format('woff'),url('../font/fontawesome-webfont.ttf') format('truetype'),url('../font/fontawesome-webfont.svg') format('svg');
  font-weight:normal;
  font-style:normal
}