Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:43:53+00:00 2026-06-02T09:43:53+00:00

I am currently using Jawr to compress and bundle my css, javascript and image

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:43:54+00:00Added an answer on June 2, 2026 at 9:43 am

    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:

    package com.bullethq.jawr.postprocessor;
    
    import net.jawr.web.resource.FileNameUtils;
    import net.jawr.web.resource.bundle.factory.util.PathNormalizer;
    import net.jawr.web.resource.bundle.postprocess.BundleProcessingStatus;
    import net.jawr.web.resource.bundle.postprocess.impl.CSSURLPathRewriterPostProcessor;
    import net.jawr.web.resource.bundle.postprocess.impl.PostProcessorCssImageUrlRewriter;
    
    import java.io.IOException;
    
    public class CustomCssUrlPathRewriterPostProcessor extends CSSURLPathRewriterPostProcessor {
    
        public static final String CUSTOM_URL_PATH_REWRITER = "customcsspathrewriter";
    
        public CustomCssUrlPathRewriterPostProcessor() {
            super(CUSTOM_URL_PATH_REWRITER);
        }
    
        // ========================================================================
        // ========================================================================
        // ========================================================================
        @Override
        protected PostProcessorCssImageUrlRewriter createImageUrlRewriter(BundleProcessingStatus status) {
            return new CustomPostProcessorCssImageUrlRewriter(status);
        }
    
        // ========================================================================
        // ========================================================================
        // ========================================================================
        public class CustomPostProcessorCssImageUrlRewriter extends PostProcessorCssImageUrlRewriter {
    
            public CustomPostProcessorCssImageUrlRewriter(BundleProcessingStatus status) {
                super(status);
            }
    
            // ========================================================================
            // ========================================================================
            // ========================================================================
            @Override
            protected String getUrlPath(String match, String originalPath, String newCssPath) throws IOException {
                String url = match.substring(match.indexOf('(') + 1, match.lastIndexOf(')')).trim();
    
                // Remove any quotes if necessary.
                String quoteStr = "";
                if (url.startsWith("'") || url.startsWith("\"")) {
                    quoteStr = String.valueOf(url.charAt(0));
                    url = url.substring(1, url.length() - 1);
                }
    
                // We now check if the url ends in a known image file extension
                // If not, the url is ignored.
                if (FileNameUtils.hasImageExtension(url)) {
                    return super.getUrlPath(match, originalPath, newCssPath);
                } else {
                    // We need to rewrite the path, as any relative URLs will
                    // not resolve correctly if Jawr has changed the CSS path.
                    url = PathNormalizer.concatWebPath(originalPath, url);
                    url = PathNormalizer.getRelativeWebPath(PathNormalizer.getParentPath(newCssPath), url);
                    return "url(" + quoteStr + url + quoteStr + ")";
                }
            }
        }
    }
    

    And then, you need to configure Jawr to use this custom post processor in jawr.properties:

    jawr.custom.postprocessors.customcsspathrewriter.class=com.bullethq.jawr.postprocessor.CustomCssUrlPathRewriterPostProcessor
    jawr.css.bundle.factory.filepostprocessors=customcsspathrewriter
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using YUI to compress JavaScript files via Ant: <apply executable=java parallel=false>
I'm currently using PHP, JAVASCRIPT, MYSQL, XHTML, CSS to develop my site. Note that
I am currently using PIL. from PIL import Image try: im = Image.open(filename) #
I am currently using a javascript code to make an entire row in my
Currently using Telerik ASP .NET MVC Controls version 2011.2.712 Hello all, I am trying
Im currently using jquery to link all td's to the edit link but i
Hi all I am currently using FLEX version 3.0 It just take a long
Currently using Gettext on a project and the .po files are nicely kept under
am currently using google feed api to get feed links dynamically. am trying to
Im currently using a simple javascript redirect (called on load) with a delay to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.