Open stuartf opened 11 years ago
This might not be related, but I'm finding that running the task several times with two phases results in changing file hashes in the output file for unchanged assets.
This is my task config:
ver: {
myapp: {
phases: [{
files: [
'<%= dirs.publicDir.images %>/**/*'
],
references: [
"<%= dirs.publicDir.stylesheets %>/**/*"
]
}, {
files: [
"<%= dirs.publicDir.stylesheets %>/**/*.css",
"<%= dirs.publicDir.javascripts %>/**/*.js"
]
}],
baseDirFrom: 'public/dist',
baseDirTo: 'public/',
versionFile: '<%= dirs.assets.root %>/<%= filenames.assets %>',
}
}
When I run it, some of the images (and only images) hashes change in the output file. When I take out the second phase (which doesn't run on the images), this stops happening.
I don't think this is a misconfiguration on my part as I'm following the examples in this repo's readme. I even ran md5
against the image files and confirmed they're unchanged so the hashes really should be consistent.
This might not be related to your issue, @stuartf, but it might be an indication that this plugin just isn't quite production-ready.
Hey @mattandrews, That hash issue is a bug. I forked, fixed, and made a pull request for it but it hasn't been accepted. I guess I could create an issue for it and it might get some traction.
You can grab my fork if you want and it will likely fix this issue for you. In your package.json point to the fork:
...
"devDependencies": {
...
"grunt-ver": "git://github.com/nadnoslen/grunt-ver.git",
...
}
...
Issue #13 created concerning the previous hashing comments.
If you hash two files on different paths that have the same filename all references that get replaced will only use the same hash. For instance if you have MathJax in your path like:
Then when you hash it you get something like:
So far so good, but when you look in a file that references one of those say
vendor/js/MathJax/jax/input/MathML/config.49dbdf64.js
for example, you'll find stuff like:Which should actually be:
Separating the processing into phases won't fix this, but separate tasks will. For a large project it can result in a lot of headaches.