I am currently using Jawr to compress and bundle my css, javascript and image files.
Jawr is currently converting all of the url() links in my css files, regardless whether they are images or not. For example:
@font-face {
font-family: 'NothingYouCouldSay';
src: url('../fonts/NothingYouCouldSay.eot') format('eot');
src: local("☺"), url('../fonts/NothingYouCouldSay.woff') format('woff'), url("../fonts/NothingYouCouldSay.otf") format("opentype"), url('../fonts/NothingYouCouldSay.ttf') format('truetype'), url('../fonts/NothingYouCouldSay.svg') format('svg');
font-weight: normal;
font-style: normal;
}
Jawr is converting all of the url() values, but then the resources cannot be found when the webserver is running, as I have configured the image servlet to listen only for *.png & *.jpg.
@font-face {
font-family: 'NothingYouCouldSay';
src: url('../../../cb1130234589/resources/fonts/NothingYouCouldSay.eot') format('eot');
src: local("☺"), url('../../../cb1130234589/resources/fonts/NothingYouCouldSay.woff') format('woff'), url("../../../cb1130234589/resources/fonts/NothingYouCouldSay.otf") format("opentype"), url('../../../cb1130234589/resources/fonts/NothingYouCouldSay.ttf') format('truetype'), url('../../../cb1130234589/resources/fonts/NothingYouCouldSay.svg') format('svg');
font-weight: normal;
font-style: normal;
}
If I add *.woff to the image servlet mapping, then the servlet complains that the mime type of the file is not understood.
Is there any way I can get Jawr to not process these particular particular URLs?
So, after trying a few different ideas, I ended up writing my own custom post processor to handle this. I reuse as much of the existing Jawr code as possible, which means it may be quite brittle if Jawr changes it's underlying code.
Anyway, here's what I wrote:
And then, you need to configure Jawr to use this custom post processor in jawr.properties: