First off thanks for making Rev-All its working really well for me so far all things considered. I am still kinda lost how everyone is supposed be able to quickly just start using Gulp-Rev and the given manifest files like its nothing with so few docs or examples. How is a new person to the JS and Gulp ecosystem supposed to be able to reinvent this level cache busting with only manifest files a time efficient manner their first time. I under stand making your own Gulpy solutions and they are great but Rev-All is doing things right, and at least getting us 99.9% of the way there out of the box. Loving it.
I'm here to report the edge case issue I had with RequireJS bundling and hashing, ideally it can get fixed but it feels a little unique despite it being something it feels like everyone should be doing, namely hashing everything completely.
Basically you bundle you RequireJS AMD modules with the R.JS optimizer and you end up with a common bundle and then optionally you break off packages of code to lazy load in later for pages or features that users won't see right away to reduce page size, sounds great and it is until you want to long cache everything with the help of rev hashing. RequireJS wants you to list all of those lazy loaded bundles without the .js extension internally because it knows how to read it, but that basically makes Rev-All miss the reference link and because of that hashed.js bundle file isn't loaded. All that really matters is the "name of the bundle", the "about":[, the other parts stay the same. if you add the hash to the internal reference to the bundle (still without the .js) it works great.
I've already hacked out a really simple solution to patch it that that runs after the Rev-All task and adds the hash references into the common bundle as seen in the second picture, so I wanted to share that Gist (loaded with comments to try and explain it in case others need it too, it took too much effort for how easy it should have been). _RequireJS, and r.js multi-bundle edge case with Gulp-Rev-All Gist patch code_
It works but I'd love to see if anyone can show me how to make it more robust. I would have submitted a pull request but frankly I'm still too new to JavaScript and gulp etc to understand the Rev-All source well enough to add to it well effectively. Maybe you can work out the issue from my Gist and make a real solution.
One thing I did notice trying to work through the Rev-All source,
in Tool.js line 61: "return crypto.createHash('md5').update(str, 'utf8').digest('hex');"
Why are we adding the effect hex digest? It makes the resulting hash different from what the normal Gulp-Rev hash outputs. I only bring it up because my original plan was to use a Rev-Manifest.json like they suggest to do it all by hand, but then I noticed the difference in hashes, odd, and changed plans to just patch on top of the Rev-All output because it is already 99% working out of the box.
Side note though, why can't we have a Rev-All manifest file?
_I think it would be useful to have a .json file that is basically a tree of your build structure with hashes recorded for archiving alongside the locked in artifact version number of a release in git for example_. Say I wanted to support multiple builds in production (maybe mobile apps on many phones over time etc) it would be useful to have a Rev-All-Manifest.json with all the hash values for each version and files that are tagged as a public release in Git, then any errors or bug reports that came in about file "X-{hash}.js" could be referenced using the manifest file hash to help narrow things down while debugging rather then the hash being a hindrance adding to the complexity of the bug. Just a suggestion, or if that is possible already I'd like to hear about how to do that with Rev-All easily.
Anyway look at the Gist for details, lot of comments and pictures. Let me know what you think.
_RequireJS, and r.js multi-bundle edge case with Gulp-Rev-All Gist patch code_
The RegEx is used was built and tested with , great site. This is a small example of a jsonString from the Gist that would represent the .js files in your build dir after using Rev-All, and you'd match it with
/\"\.\/[a-z]*\/(([^\"\/.]*).[a-z0-9.]*)\.js\"/ig
["./build/about.4633414d.js","./build/about.4633414d.js","./build/charts.fb997bcb.js","./build/etc.fb997bcb.js","./build/scripts.ee82b2ec.js"]