https://github.com/elc/bundler_cache_busting
A bundler and cache busting plugin for Pelican
https://github.com/elc/bundler_cache_busting
Last synced: about 1 year ago
JSON representation
A bundler and cache busting plugin for Pelican
- Host: GitHub
- URL: https://github.com/elc/bundler_cache_busting
- Owner: ELC
- License: bsd-3-clause
- Created: 2018-10-28T12:03:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-28T12:19:21.000Z (over 7 years ago)
- Last Synced: 2025-02-14T01:23:43.512Z (over 1 year ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bundler and Cache Busting for Pelican
This plugin generates a bundle file for all the css files and a bundle file for all the js files. It simply concatenates without minifing or compressing. Useful for reducing the number of requests without any performance overhead. It also modifies the base theme HTML file and appends a hash of the file at the end to improve change detection when using cache systems or service workers.
It works with no no dependencies apart from pelican itself.
## Installation
Set up like any other plugin, making sure to set `PLUGIN_PATH` and add `bundler_cache_busting` to the `PLUGINS` list.
## Configuration
- `THEME_STATIC_DIR` (Optional): The directory for the theme folder
- `THEME_BASE_TEMPLATE`: The path for the base.html where all the links to the static files are.
- `FILES_TO_CACHE_BUSTING`: A list of paths to the files which will have cache busting, it could be the ouput of the bundler itself. If not set, it disables the cache busting part.
Examples:
### Using the same output from the bundler
```python
FILES_TO_CACHE_BUSTING = (
'js/scripts.js',
'css/style.css',
)
```
Will produce:
...
## Usage
Bundler works automatically with no configuration, it will concatenate the files in alphabetical order. Cache Busting will only work if the `FILES_TO_CACHE_BUSTING` is ser.