# postcss-cachebuster

> Cachebusting all local files in css

Latest version **0.1.6** (published 2018-12-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-cachebuster
pnpm add postcss-cachebuster
yarn add postcss-cachebuster
bun add postcss-cachebuster
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2018-12-07 |
| First published | 2015-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Gleb Mikheev |
| Maintainers | bubujka, glebmachine |
| Keywords | postcss, css, postcss-plugin, cachebuster, caching, cachefile, cache, control, network, optimize |

## Links

- npm: https://www.npmjs.com/package/postcss-cachebuster
- Repository: https://github.com/glebmachine/postcss-cachebuster
- Issues: https://github.com/glebmachine/postcss-cachebuster/issues
- npm.io page: https://npm.io/package/postcss-cachebuster

## Dependencies (4)

- [path](https://npm.io/package/path.md) ^0.12.7
- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [postcss](https://npm.io/package/postcss.md) ^5.0.12
- [canonical-path](https://npm.io/package/canonical-path.md) 0.0.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.6 (latest) — 2018-12-07
- 0.1.5 — 2017-06-30
- 0.1.4 — 2017-01-09
- 0.1.3 — 2016-05-27
- 0.1.2 — 2015-11-19
- 0.1.1 — 2015-11-19
- 0.1.0 — 2015-11-14
- 0.0.0 — 2015-08-16

## README

# PostCSS Cachebuster [![Build Status](https://travis-ci.org/glebmachine/postcss-cachebuster.svg?branch=master)](https://travis-ci.org/glebmachine/postcss-cachebuster) [![npm version](https://badge.fury.io/js/postcss-cachebuster.svg)](http://badge.fury.io/js/postcss-cachebuster)

[PostCSS] plugin added cachebuster to local files based on their datechanged.


## Input css example
```css
@import url("/css/styles.css");
.foo {
  background-image : url('../images/index/logo.png');
  behavior : url('../behaviors/backgroundsize.min.htc');
}
@font-face {
  font-family: 'My font';
  src: url('fonts/myfont.ttf');
}
```

## Output css example
```css
@import url("/css/styles.css?v66f22a33fff");
.foo {
  background-image : url('../images/index/logo.png?v14f32a475b8')
  behavior : url('../behaviors/backgroundsize.min.htc?v15f55a666c2');
}
@font-face {
  font-family: 'My font';
  src: url('fonts/myfont.ttf?v32f14a88dcf');
}
```

## Configure
```js
postcss([ 
  require('postcss-cachebuster')({
    imagesPath : '/images', 
    cssPath : '/stylesheets'
  }) 
])
```
See [PostCSS] docs for examples for your environment.

## Options

- `cssPath` - option to redefine relative images resolving directory (by default the same as css file folder)
- `imagesPath` - variable to define absolute images base path
- `type` - define cachebuster type, `mtime` by default, allows: `mtime`, `checksum` (checksum based on md5),
  or a function which receives the absolute path to the file as an argument and whose return value becomes
  the url pathname.


## Contributors
- Gleb Mikheev (https://github.com/glebmachine)
- Graham Bates (https://github.com/grahambates)
- Yusuke Yagyu (https://github.com/gyugyu)
- Jackson Ray Hamilton (https://github.com/jacksonrayhamilton)

---
_Source: https://npm.io/package/postcss-cachebuster · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
