Skip to content

shakyShane/cache-breaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Cache Breaking Tasks Build Status

Note: This modules does nothing with the file system, that means you'll have to read/write files yourself, or wait for the Grunt & Gulp Plugins

##Install

npm install cache-breaker

##Use in project

var cacheBreaker = require("cache-breaker");

###Usage Examples

Append a timestamp as query string

var string   = '<link href="/style.css" /><link href="/style2.css" />';

cacheBreaker.breakCache(string, ['style.css', 'style2.css']);

// output
// <link href="/style.css?rel=23452341" /><link href="/style2.css?rel=23452341" />

Append a timestamp in the filename

var string   = '<link href="/style.css" />';

cacheBreaker.breakCache(string, 'style.css', {position: 'filename'});

// output
// <link href="/style.56432352.css" />

Overwrite an exiting timestamp

Use this when you have rewrite rules in place.

var string   = '<link href="/style.2452345.css" />';

cacheBreaker.breakCache(string, 'style.*.css', {position: 'overwrite'});

// output
// <link href="/style.56432352.css" />

##TODO

  • Grunt Plugin
  • Gulp Plugin
  • Accept file src for creating MD5 hash
  • Allow user-specified string in place of timestamp

About

Cache Breaking tasks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published