0.1.0 • Published 7 years ago

gulp-ui5-cachebuster v0.1.0

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

gulp-ui5-cachebuster

Needed something that created the cache buster file and directories for me. I'll expand on this sometime to make a fancier one. For now, this'll do.

Info:

By default, Browsers cache files. Why fetch something when you already have it? Usually this is great and it'll speed up your application. Sometimes you make changes though and your customers should fetch a fresh copy from the server instead of using their locally cached one. The process of enabling such a refresh is known as a cache buster.

In short, the way UI5 implements it, is by providing a file called sap-ui-cachebuster-info.json which contains the files and cache buster folder, something like this:

{
  "my/app/App.controller.js": "1495521267770"
}

I implement these on a time stamp but you have the freedom to change this.

Basic usage

Part of my gulp file:

const cachebuster = require('gulp-ui5-cachebuster');

const APP = './';
const DIST = `${APP}/dist`;
const SRC = `${APP}/src`;
const TIME = new Date().getTime(); //ie, 1495521267770

gulp.task("copy:cachebuster", () => {
  return gulp.src([
      `${DIST}/**/*`
    ])
    .pipe(cachebuster(TIME, 'dist'))
});

Generates the json file.

More info

Read more over here