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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:36:59+00:00 2026-06-10T06:36:59+00:00

I would like to have all javascript, css and images that are sent to

  • 0

I would like to have all javascript, css and images that are sent to the browser to be concatenated, minified and have a md5 cache busting filename. I’ve been able to achieve this with packages like connect-assets and others.

However I have not been able to add the md5’ed image filename into the css before it is processed.

I am using Less css templates.

Any pointers to packages that could help me would be great.

eg

image.png is converted to image-455454545.png
css references background-image: url(image.png) -> should change to image-455454545.png

  • 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-10T06:37:00+00:00Added an answer on June 10, 2026 at 6:37 am

    As far as I know, Less doesn’t have the ability to utilize user-defined functions. Stylus, however, does. So if you’re willing to hop onto an alternate CSS preprocessor, then there is great fun to be had! (Stylus is really very simliar to Less, and it shouldn’t take much to switch to it. Plus connect-assets already supports Stylus, so it should plug into your environment easily.)

    server.js

    var fs = require('fs');
    var stylus = require('stylus');
    
    stylus(fs.readFileSync("styles.styl", 'utf8')) //load stylus file
      .define("versionedFile", versionedFile) //add our custom function to the stylus env
      .render(function(err, css){ //render!
        if (err) {
          throw err;
        }
    
        fs.writeFileSync("styles.css", css); //write the compiled css to a .css file
    });
    
    //our custom function
    function versionedFile(filename) {
      ... lookup versioned file of filename ...
      return "versionedFilename.png"
    }
    

    styles.styl

    .image-block {
      background-image: url(versionedFile('unversionedFilename.png')); //this is how we use our custom function
    }
    

    Which will compile into:

    styles.css

    .image-block {
      background-image: url("versionedFilename.png"); //hooray!
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to select all elements that have certain attribute or don't have
I have a DataGridView that I would like all values on a specific row
I have a blog installed in www.foo.com/wp/ and would like all requests that go
I have a list of files that I would like analyze. They are all
I have a container class which I would like to use to print all
I have a CSV file and I would like to filter all the lines
I have a list of parent/child IDs and would like to get all child
I have 2 event handlers: Y.all(.ptl).on(mouseover, handleOverlay); Y.all(.ptl).on(mouseout, handleOverlay); And I would like to
I have an HTML page. I would like to extract all elements whose name
I have a base class, and I would like to catch all exceptions of

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.