Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-04T14:54:59.000Z (almost 5 years ago)
- Last Synced: 2024-11-15T21:33:08.233Z (3 months ago)
- Topics: cache, gulp, gulp-plugin
- Language: JavaScript
- Homepage: https://npm.im/gulp-local-cache
- Size: 769 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-local-cache
[![StandardJS](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![travis-ci build status](https://api.travis-ci.org/chrisdothtml/gulp-local-cache.svg?branch=master)](https://travis-ci.org/chrisdothtml/gulp-local-cache/branches)
[![Coverage status](https://coveralls.io/repos/github/chrisdothtml/gulp-local-cache/badge.svg)](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)