Closed rayliao closed 5 years ago
Here's one way to do it.
https://github.com/yeoman/generator-gulp-webapp/blob/master/docs/recipes/asset-revisioning.md
gulp-rev
appends content hashes like this:
unicorn.css → unicorn-d41d8cd98f.css
It change the name of the file, but I can't think of change the file name, is just add the version number: unicorn.css → unicorn.css?v=d41d8cd98f
If you do this with useref, the version hash will be useless, because it will be changed only when you change the file, losing the "no-cache stuff"
One way to do this is to correctly handle the cache headers with the server but sometimes it's not possible, so you could do it yourself.
Example with php: echo "unicorn.css?v=" . strval(microtime(true));
Probably there is an automatic lib that can handle that for you
@jonkemp
Here's one way to do it.
That obviously doesn't work with gulp-useref v3. Got any other suggestions?
I submitted a pull request to update that doc last night and it's been merged. I tested that myself and it works. :hand:
@jonkemp thank you very much, that was definitely helpful.
@jonkemp It`s work. Thanks.
Some update about doing:
unicorn.css → unicorn.css?v=d41d8cd98f
instead:
unicorn.css → unicorn-d41d8cd98f.css
?
I want the resulting HTML like this: