Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

Flask-Cache-Buster is a lightweight Flask extension that adds a hash to the URL query parameters of each static file. This lets you safely declare your static resources as indefinitely cacheable because they automatically get new URLs when their contents change.

Usage

from flask_cache_buster import CacheBuster

config = {
     'extensions': ['.js', '.css', '.csv'],
     'hash_size': 10
}

cache_buster = CacheBuster(config=config)
cache_buster.register_cache_buster(app)

The url_for function will now cache-bust your static files. For example, this template:

<script src="{{ url_for('static', filename='js/main.js') }}"></script>

will render like this:

<script src="/static/js/main.js?%3Fq%3Dc5b5b2fa19"></script>

License

MIT

TODO

  • python 2.7 support
  • add tests

Inspired by ChrisTM/Flask-CacheBust

About

A lightweight flask extension that cache-busts static files by adding content-based query parameters to their URLs

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.