https://github.com/vitalk/flask-staticutils
[Deprecated] Flask extension that provides a simple way to add revision info to your app static assets.
https://github.com/vitalk/flask-staticutils
Last synced: about 2 months ago
JSON representation
[Deprecated] Flask extension that provides a simple way to add revision info to your app static assets.
- Host: GitHub
- URL: https://github.com/vitalk/flask-staticutils
- Owner: vitalk
- Created: 2013-02-23T09:29:50.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-23T09:30:44.000Z (over 13 years ago)
- Last Synced: 2025-02-26T18:52:43.390Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
FLASK-STATICUTILS
Flask extension that provides a simple way to add revision info to your app
static assets.
WHAT
This extension provides:
* the ability to version application static files by checksum of the their
contents (or any other user-defined method)
WHY
Because you MUST cache static content. But even though your static content
changes infrequently, when it does, the cached content needs to be invalidated.
Including the version of your content as part of URL (not querystring) allows to
control cache invalidation more flexibly.
HOW
pip install -e git+git@bitbucket.org:vitalk/flask-staticutils.git#egg=flask-staticutils
Use default flask API to customize following settings:
STATIC_UTILS_FORMATSTR format string used to produce asset path,
default is '/%(path)s-%(rev)s%(ext)s'.
For example,
'foo/bar.css' → '/foo/bar-17e073c333c6.css'
'foo/bar' → '/foo/bar.17e073c333c6'
STATIC_UTILS_FILTER_NAME name of jinja filter, default is 'rev'
STATIC_UTILS_REV_LENGTH truncate revision to that length, default is 12
'foo/bar.css' → 'foo/bar-17e073c333c6.css'
|<-------->|
checksum truncated to 12 symbols
STATIC_UTILS_REV_GENERATOR ready to import path to the revision generator,
default is 'flask.ext.staticutils.FileChecksumRev'
THANKS
Inspired by the django-staticutils (https://github.com/workshop33/django-staticutils)
COPY
Copyright © 2013 Vital Kudzelka .
Licensed under The MIT License (http://opensource.org/licenses/MIT).