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 6993921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:49:32+00:00 2026-05-27T19:49:32+00:00

Looking for a build-time CSS combiner/minifier that respects relative URL references. That is, if

  • 0

Looking for a build-time CSS combiner/minifier that respects relative URL references.

That is, if one of the files I am combining is at

/path/to/style.css

and contains

background-image: url(images/my-image.png)

the resulting file should contain

background-image: url(/path/to/images/my-image.png).

Should work cross-platform Mac and PC, so either .NET via Mono or Node seem like obvious choices.

  • 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-05-27T19:49:32+00:00Added an answer on May 27, 2026 at 7:49 pm

    Check out WebAssets / Github

    Asset management application for Python web development – use it to
    merge and compress your JavaScript and CSS files.

    It includes filters/ precompiles for cssmin, cssutils, yui_css, less, sass, clevercss, compass, scss, coffeescript, gzip, etc.

    Specific to your question:

    cssrewrite Source filter that rewrites relative urls in CSS files.

    CSS allows you to specify urls relative to the location of the CSS
    file. However, you may want to store your compressed assets in a
    different place than source files, or merge source files from
    different locations. This would then break these relative CSS
    references, since the base URL changed.

    This filter transparently rewrites CSS url() instructions in the
    source files to make them relative to the location of the output path.
    It works as a source filter, i.e. it is applied individually to each
    source file before they are merged.

    No configuration is necessary.

    The filter also supports a manual mode:

    get_filter('cssrewrite', replace={'old_directory', '/custom/path/'})
    

    This will rewrite all urls that point to files within old_directory to use /custom/path as a prefix instead.

    General Usage:

    from webassets import Environment
    my_env = Environment('../static/media', '/media')
    
    """"As you can see, the environment requires two arguments,
    the path in which your media files are located, as well as     
    the url prefix under which the media directory is available. 
    This prefix will be used when generating output urls.  Next, 
    you need to define your assets, in the form of so called 
    bundles, and register them with the environment. The easiest     
    way to do it is directly in code:""""
    
    from webassets import Bundle
    js = Bundle('common/jquery.js', 'site/base.js', 'site/widgets.js', filters='jsmin', output='gen/packed.js')
    my_env.register('js_all', js)
    

    In this case you’ll replace your js src with output.
    Here is an alternate notation:

    directory: ../static
    url: /media
    debug: True
    updater: timestamp
    
    bundles:
        bundle-name:
            filters: sass,cssutils
            output: cache/default.css
            contents:
                - css/jquery.ui.calendar.css
                - css/jquery.ui.slider.css
    

    Also has special hooks for Django, Flask, Jinja2, Werkzeug..

    Documentation is here. Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to build a flyout type menu in Silverlight that will be added
I am looking to build an app that has 6 view controllers laid out
I develop / maintain an application that takes a long time to build (as
I'm looking to build a server with lots of tiny files delivered by an
I'm looking for some way to replace patterns in files with values, during build
I am looking to build an application that has a couple different modes. The
I am looking for a caching framework that supports expiring values a specified time
I'm looking to build and publish a latex document every time I advance the
Im looking to build a simple upload site, that will generate temporary URLS to
I am looking to build a web app that implements background audio and fast

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.