Created
December 10, 2014 18:25
-
-
Save zeroeth/6a11ae9ee1dddb6d7246 to your computer and use it in GitHub Desktop.
js cache invalidator
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
| #!/bin/sh | |
| # Helper for conditional inclusion of features. | |
| function command_exists() { | |
| type "$1" &> /dev/null ; | |
| } | |
| file_signature() { | |
| if command_exists sha256 | |
| then | |
| sha256sum $1 | awk '{ print $1 }' | |
| else | |
| shasum -a 256 $1 | awk '{ print $1 }' | |
| fi | |
| } | |
| cat index.html.template |\ | |
| sed "s/{{build_date}}/$(date)/g" |\ | |
| sed "s/{{js_signature}}/$(file_signature dist/aris.js)/g" |\ | |
| sed "s/{{css_signature}}/$(file_signature styles/arisjs.css)/g" \ | |
| > index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment