https://github.com/chrisdothtml/gulp-local-cache
A gulp plugin that provides a persisted file cache
https://github.com/chrisdothtml/gulp-local-cache
cache gulp gulp-plugin
Last synced: 5 months ago
JSON representation
A gulp plugin that provides a persisted file cache
- Host: GitHub
- URL: https://github.com/chrisdothtml/gulp-local-cache
- Owner: chrisdothtml
- License: mit
- Created: 2016-11-22T14:33:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-04-04T14:54:59.000Z (about 6 years ago)
- Last Synced: 2025-09-19T17:49:01.727Z (9 months ago)
- Topics: cache, gulp, gulp-plugin
- Language: JavaScript
- Homepage: https://npm.im/gulp-local-cache
- Size: 769 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-local-cache
[](https://standardjs.com)
[](https://travis-ci.org/chrisdothtml/gulp-local-cache/branches)
[](https://coveralls.io/github/chrisdothtml/gulp-local-cache)
> A gulp plugin that provides a persisted file cache
## Install
```bash
yarn add -D gulp-local-cache
# npm works too
npm i -D gulp-local-cache
```
## Use
```javascript
const cache = require('gulp-local-cache')
const gulp = require('gulp')
gulp.task('lint', () => {
return gulp.src('src/*.js')
.pipe(cache.filter())
// ...
```
### cache.clear([key])
Clear the cache. A key can be provided to specifically clear that cache
```javascript
// clear entire cache
cache.clear()
// only clear `assets` cache
cache.clear('assets')
```
### cache.filter([key])
Filter out cached files that haven't changed. An optional cache key can be provided if you need to, for example, cache files at multiple stages of the build
```javascript
gulp.task('assets', () => {
return gulp.src('*.js')
.pipe(cache.filter('assets'))
// ...
```
### cache.path([filepath])
Get or set the location of the cache file. Default path is `.gulpcache`
```javascript
// get current
cache.path()
// set new
cache.path('.cache/my-cache')
```
## License
[MIT](LICENSE)