Created
October 17, 2012 22:29
-
-
Save jarcoal/3908746 to your computer and use it in GitHub Desktop.
Versioning Static Assets w/ Heroku Config Vars
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
heroku config:add JS_VERSION=1 CSS_VERSION=1 --app=YOUR_APPLICATION_NAME |
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
TEMPLATE_CONTEXT_PROCESSORS = ( | |
'path.to.static_processor', | |
... | |
) |
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
<link rel="stylesheet" type="text/css" href="/path/to/stylesheet.css?v={{ static_versions.css }}"> | |
<script type="text/javascript" src="/path/to/logic.js?v={{ static_versions.js }}"></script> |
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
import os | |
def static_processor(request): | |
versions = { | |
'js': os.environ.get('JS_VERSION'), | |
'css': os.environ.get('CSS_VERSION'), | |
} | |
return { 'static_versions': versions } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment