kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
926 stars 525 forks source link

Replace random id for minified JS/CSS by shasum #153

Closed kakawait closed 3 years ago

kakawait commented 7 years ago

In order to avoid getting new file even no modification I have to replace https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/tasks/config/uglify.js#L5 and https://github.com/kakawait/hugo-tranquilpeak-theme/blob/master/tasks/config/cssmin.js#L12 by something using hash function like sha256sum or something else

ghost commented 7 years ago

@kakawait good call. it's really up to the CDN to handle cache busting when a file changes. it's strange we used to fingerprint files when an HTTP header would have done the trick.

kakawait commented 7 years ago

Actually I manually check if content has changed and remove new version if needed. So I never commit something with new ID without change. But I will save my time if it can be manage by builder :)

But about header, I keep fp because no every user is aware of such thing

ghost commented 7 years ago

But about header, I keep fp because no every user is aware of such thing

That's thoughtful. Maybe there could be a config option to turn it on and off in a centralized Gruntfile so it's easier for those who wish to disable can do so in one place? Just a thought.

ghost commented 7 years ago

Also, I understand you can typically use the first seven characters of a file SHA to uniquely identify the file, enabling you to keep the number of characters added to a minimum. The rub here, and with using different filenames in general, is that it makes debugging more complex because you're no longer debugging the same file (so you lose breakpoints in your step debugger).

kakawait commented 7 years ago

@jhabdas I used to debug with un-minified and un-concatened file but I'm agree with you. I will think about that following:

Maybe there could be a config option to turn it on and off in a centralized Gruntfile so it's easier for those who wish to disable can do so in one place?

kakawait commented 3 years ago

Close because the goal will be to no use npm anymore and use Hugo directly for that. And so no more bundles