Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including gulp-asset-cache with all npm packages installed. Try it out:

var gulpAssetCache = require("gulp-asset-cache")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

gulp-asset-cache v1.1.5

A disk based caching task for gulp


Build Status Coverage Status bitHound Dependencies

A disk based caching task for gulp. This plugin was built mainly to deal with the issues around having no dist directory and wanting to prevent image/video compression from happening multiple times on larger teams. If you do have the luxury of a src/dist file structure I recommend gulp-changed or gulp-newer as they easily integrate with that setup.


Install package with NPM and add it to your development dependencies:

npm install gulp-asset-cache


Below is a basic example of using the cache to manage image minification with the imagemin module.

const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
const assetCache = require('gulp-asset-cache');

gulp.task('images', function() {
  return gulp.src('./images/*.{jpg,png,jpeg,gif,svg}')
    // Specify the location and name of the cache file
      verbose: true

This will create a cache file named .image-cache of all files passed through the pipeline to be excluded from subsequent runs. If a file that has been cached is updated, the cache will recognize this and pass the file through to update it in the cache.



Generate a file that will contain all of the information related to the cache. If a file already exists, it will filter out the items within the cache from the stream.


NameTypeDefault ValueDescription
cacheNamestring'./.asset-cache'The name and location of where the cache file will be saved.


Create or update the currently streamed cache file.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free