Skip to content

Instantly share code, notes, and snippets.

@jarcoal
Created October 17, 2012 22:29
Show Gist options
  • Save jarcoal/3908746 to your computer and use it in GitHub Desktop.
Save jarcoal/3908746 to your computer and use it in GitHub Desktop.
Versioning Static Assets w/ Heroku Config Vars
heroku config:add JS_VERSION=1 CSS_VERSION=1 --app=YOUR_APPLICATION_NAME
TEMPLATE_CONTEXT_PROCESSORS = (
'path.to.static_processor',
...
)
<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>
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