Skip to content

Instantly share code, notes, and snippets.

@leevigraham
Created November 26, 2014 12:01
Show Gist options
  • Save leevigraham/b48ed5382e497a6497ac to your computer and use it in GitHub Desktop.
Save leevigraham/b48ed5382e497a6497ac to your computer and use it in GitHub Desktop.
Asset renaming with [gulp|grunt]-rev and git history
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.
@StevenLangbroek
Copy link

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.

@leevigraham
Copy link
Author

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.

@StevenLangbroek
Copy link

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