Socket
Socket
Sign inDemoInstall

gulp-css-resource-cache-buster

Package Overview
Dependencies
3
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-css-resource-cache-buster

Cache buster plugin for remote/local resources specified by CSS.


Version published
Weekly downloads
18
increased by20%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

gulp-css-resource-cache-buster

Build Status npm version

Cache buster for resources specified in CSS files.

This plugin add a query string to the resouce URLs in the CSS. The query string is a MD5 of the resource. So, when the resource got changed, an user agent can not use the cache, because the URL was changed.

You should specify a URL converting table that is a map to URLs in the CSS to the real URLs to the resource. This plugin fetch the resource to get the MD5 if the real URL is a remote URL.

For example:

@font-face {
  font-family: 'MyFont';
  src: url('local/rel/file.eot') format('eot'),
       url('/local/abs/file.woff') format('woff'),
       url('/remote/file.ttf') format('truetype');
}

becomes:

@font-face {
  font-family: 'MyFont';
  src: url('local/rel/file.eot?md5-by-cache-buster=dbbe284acff8af485a7513fc14d8cabd') format('eot'),
       url('/local/abs/file.woff?md5-by-cache-buster=1c318b6e722437694bba4bed80aff46f') format('woff'),
       url('/remote/file.ttf?md5-by-cache-buster=ee25807e36fcdcdf4ea55311f15e3f66') format('truetype');
}

by the code:

gulp.src('path/to/file.css')
  .pipe(cssResourceCacheBuster({
    'local/rel/file.eot': './local/rel/file.eot',
    '/local/abs/file.woff': './local/abs/file.woff',
    '/remote/file.ttf': 'http://example.com/remote/file.ttf'
  }))
  .pipe(gulp.dest('path/to/modified-file.css'));

Install

npm install --save-dev gulp-css-resource-cache-buster

License

MIT

Keywords

FAQs

Last updated on 19 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc