https://github.com/focus-shift/snowpack-plugin-cache-bust
This snowpack plugin adds a content hash to your referenced scripts and stylesheets in html files.
https://github.com/focus-shift/snowpack-plugin-cache-bust
snowpack
Last synced: 9 months ago
JSON representation
This snowpack plugin adds a content hash to your referenced scripts and stylesheets in html files.
- Host: GitHub
- URL: https://github.com/focus-shift/snowpack-plugin-cache-bust
- Owner: focus-shift
- License: mit
- Archived: true
- Created: 2020-11-22T15:59:43.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-14T20:38:16.000Z (almost 4 years ago)
- Last Synced: 2024-10-02T09:53:45.832Z (over 1 year ago)
- Topics: snowpack
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 3
- Watchers: 6
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> **Update (April 20, 2022):** Snowpack is no longer actively maintained and is not recommended for new projects.
>
> Check out [Vite](https://vitejs.dev/) for a well-maintained Snowpack alternative.
> See also: [esbuild](https://esbuild.github.io/), [parcel](https://parceljs.org/)
# snowpack-plugin-cache-bust
This [snowpack](https://www.snowpack.dev) plugin adds a content hash to your referenced scripts and stylesheets in html files.
The hash is created on `optimize` command. So this won't interfere developing with watch mode.
## Usage
Currently there is no published artifact in the npm registry. You have to add this plugin via github url.
```json
// package.json
{
"devDependencies": {
"snowpack-plugin-cache-bust": "https://github.com/focus-shift/snowpack-plugin-cache-bust.git#"
}
}
```
```js
// snowpack.config.js
{
plugins: [
"snowpack-plugin-cache-bust"
],
}
```
### Example
```html
```
will become
```html
```
### Plugin options
`snowpack-plugin-cache-bust` can be configured with following options:
```js
// snowpack.config.js
{
plugins: [
["snowpack-plugin-cache-bust", options]
],
}
```
| Name | Type | Description |
| :--------- | :-------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `netflify` | `boolean` | (_default: false_) Set this to `true` if you want a `_header` file to be created that enables [cache-control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) for netlify. |