staticbuster

0.0.3 • Public • Published

staticbuster

Cache buster for static resources in HTML pages.

Installation

Node.js

npm install staticbuster --save

Imagine this scenario:

index.html

<!DOCTYPE html>
    <html>
        <head>
            <script src="res/html2canvas.js"></script> 
            <link rel="stylesheet" href="res/colpick.css">   

You may have cache problems! staticbuster adds a cache buster for each resource. For example:

            <script src="res/html2canvas.js?_sb=1512833988607"></script> 
            <link rel="stylesheet" href="res/colpick.css?_sb=1512833988607">   

Usage

const staticbuster = require('staticbuster');
 
staticbuster({
    file: 'path/index.html'
})
.then(() => console.log('ok'))
.catch(err => console.err(err));

Options

Name Type Default Description
file string or array of string File(s) to process
dest string Optional, file destination
busterParam string _sb Optional, buster param
busterValue string timestamp Optional, buster value
saveCopy boolean true Optional, save a copy

CLI

$ staticbuster --help

  Options:

    -V, --version              output the version number
    -f, --file <fileName>      file to process
    -d, --dest [destination]   optional file destination
    -b, --saveCopy [boolean]   optional save a copy
    -p, --busterParam [param]  optional buster param, default is _sb
    -v, --busterValue [value]  optional buster value, default is the timestamp
    -h, --help                 output usage information

Changelog

You can view the changelog here

License

staticbuster is open-sourced software licensed under the MIT license

Author

Fabio Ricali

Package Sidebar

Install

npm i staticbuster

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

67.2 kB

Total Files

20

Last publish

Collaborators

  • fabioricali