Does this support replacing the revved versions as the prior version did? #3

dariusriggins opened this Issue Dec 14, 2012 · 19 comments


None yet

9 participants


I'm wondering how to use this in conjunction with the hash revving it used to have. I'm not using it with Yeoman, but stand alone, I can use the old rev task to generate the hashed files, but this task doesn't seem to pick them up. I'm wondering if I'm doing something wrong or this just doesn't support it yet, and if so, is there a plan to? or an alternative in mind?


It must support it. If it does not work, I would say it's a bug (either in the documentation, leading to an invalid configuration, or in the code).

Please give me all possible details, regarding the directory layout you're using, configuration and tasks...


I'm actually just doing it in place right now on my index.html to make sure it all works. Here's my config below. Also I didn't see that it was revving any files with the hash, so I used the HTML5BP one from the Yeoman tasks folder and modified it to work on Grunt 0.4. Here's the gist for that:

useminPrepare: {
html: 'index.html'

usemin: {
  html: ['index.html']

// Renames JS/CSS to prepend a hash of their contents for easier
// versioning
rev: {
  js: 'main.js'

Also, here's the code I'm running.


grunt.registerTask('default', ['rev', 'usemin']);


Did you add also a task to chain the calls, like:

grunt.registerTask('default', ['useminPrepare', 'rev', 'usemin']);

Yeah, I have that exact order. The interesting thing is I typically have a uglify step that runs first to create the main.js file, but it doesn't even work to replace that if I leave that in. It does replace all of my <!-- build* --> blocks correctly, but not the rev'd file. Here's a look at my index.html file in case that can shed some light on things.


Humm .. I do not understand: the main.js is supposed to be created by the usemin task.. not by the uglify one.
Additionally, in your first comment you seems to forget the useminPrepare target: grunt.registerTask('default', ['rev', 'usemin']);


Yeah, I just pushed through, I think I have it working now, my problem may of been I wasn't pushing it to a staging directory first. Now that I'm doing something like

grunt.registerTask('default', ['clean', 'mkdirs', 'uglify', 'useminPrepare', 'rev', 'usemin']);

It appears to work fine. I did encounter one other issue, but it has always existed, so I'll open another issue and get your input on it.

Yeoman member

Still won't work for me. Only ends up referencing the original file name (main.js) and not the revved one.

<!-- build:js ../dist/assets/js/main.js -->
<!-- endbuild -->
rev: {
  dist: [
    '<%= dir.dist %>/assets/js/main.js'
grunt.registerTask('build', ['clean', 'jshint', 'copy', 'compass', 'mincss', 'useminPrepare', 'concat', 'uglify', 'imagemin', 'rev', 'usemin', 'htmlmin']);
@sindresorhus sindresorhus reopened this Feb 3, 2013

seems like this is a work-in-progress. trying to build my site with the 1.0 beta and nothing is revved.


The revved task has been forgotten ... We're implementing it ;)

Yeoman member

@danielmcormond, you could use Here's how you could implement it kevva/generator-webapp@cdc76b3.


@kevva Sweet, thanks! I'll opt for that.


Isn't works for me. You could easily reproduce it now by using generator-angular or generator-webapp to create application, build it and then check references to css and js files in index.html and compare them with an actual files names and their locations.

Yeoman member

@oaleynik, you're on Windows?


@kevva yes, exactly.


FYI I think the PR #82 will fix the Windows problems. I think Windows is thinking that the escaped RegEx backslash is a directory and therefore not correctly expanding the files

Yeoman member

Fixed by 1caecdb.

@kevva kevva closed this Apr 15, 2013

Now it works! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment