Created
November 26, 2014 12:01
-
-
Save leevigraham/b48ed5382e497a6497ac to your computer and use it in GitHub Desktop.
Asset renaming with [gulp|grunt]-rev and git history
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given unicorn.css | |
When we first run gulp-rev the filename is unicorn-098f6bcd.css | |
If we check this into git then unicorn-098f6bcd.css is added to the index | |
If we change unicorn.css and run gulp-rev the filename changes to unicorn-xxxxxxxx.css | |
Committing this to git means unicorn-098f6bcd.css is deleted and unicorn-xxxxxxxx.css is added. | |
This breaks the file history of the revved file. | |
You still have a full history of the original unicorn.css which still counts and is super important. |
Not checking in isn't an option in our current setup. We're pushing to git then deploying with deployhq. Automating build + deployments is on the cards tho.
Then I have another recommendation: keep the old built assets too, don't clean them. We had an issue where our HTML page (loaded through iOS/Android SDK in a WebView) was being cached heavily, and because every build we do is "clean", people were then missing their assets (reference pointed to old, old no longer existed). As @sindresorhus said, the history should be in the source-file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overheard this discussion on twitter, sorry for butting in :). We never check built assets in to a repo, but have the server we deploy to do the building (using Capistrano or Flightplan). The repo is for source files.