The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Cache-busting static assets in WordPress with Grunt

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #205371
    Alex Zaworski

    Hi friends,

    I’ve been trying to figure out a way to cache bust images with Grunt.

    I found grunt-cache-bust but I can’t get it to work since it gets tripped up with the whole '<?php bloginfo('stylesheet_directory'); ?>/' in image urls. I tried setting that string as the baseDir but that didn’t work at all…

    If it’s relevant, the images are in the same directory as my Gruntfile. Ideal scenario would be that it ignores that prefix.

    Am I just out of luck?

    Alex Zaworski

    I’m trying to bust expires headers with grunt.

    I mostly have it figured out for script/style enqueues— I’m talking about static assets such as images (am I just doing all of this wrong..?) which I can’t find a work-around for.

    I guess to elaborate on what I’m working with:

    grunt-cache-bust goes through a given file and appends a hash to all static asset requests, and then appends the same hash to the file itself. Since I’m working on a WordPress theme, all of the image sources are relative to <?php bloginfo('stylesheet_directory'); ?> which is tripping up the grunt module.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.