gulp-js-freezer
v0.0.7
Published
JS resources freezer. The best use for cache invalidation.
Downloads
3
Maintainers
Readme
gulp-js-freezer
JS resources freezer. The best use for cache invalidation.
What it does
Source JS files
app-script.js
subdir/subdir-script.js
Freezed files
79f2ced21645cb7800b13c899aa09177ff5cad96.js
347770f808e05d90280d6dac1723d3e6f37db08e.js
js-freeze-map.json
Freezing map file
{
"app-script.js": "../dest/79f2ced21645cb7800b13c899aa09177ff5cad96.js",
"subdir/subdir-script.js": "../dest/347770f808e05d90280d6dac1723d3e6f37db08e.js"
}
Install
Install with npm
$ npm i gulp-js-freezer --save-dev
Usage
var gulpJsFreezer = require('gulp-js-freezer');
var deployPath = '../_deploy'
gulp.task('freeze-js', function () {
return gulp.src('../static/js/**/*.js')
.pipe(gulpJsFreeze({freezeMapBaseDir: '../static/js'}))
.pipe(gulp.dest(deployPath)) // writes freezed resources
.pipe(gulpJsFreezer.freezeMapResolve()) // creates map of freezed resources
.pipe(gulp.dest(deployPath)) // writes freeze map file
})
Options
var gulpJsFreezer = require('gulp-js-freezer');
var deployPath = '../_deploy'
gulp.task('freeze-js', function () {
return gulp.src('../static/js/*.js')
.pipe(gulpJsFreezer({
freezeMapBaseDir: '../static/js', // resolve paths inside map file name by freezeMapBaseDir.
// default null (writes absolute path of freezed file)
freezeNestingLevel: 3, // nesting levels of directories; default 1
freezeMapFileName: 'js-freeze-map.json' // freeze map file name; default js-freeze-map.json
}))
.pipe(gulp.dest(deployPath))
.pipe(gulpJsFreezer.freezeMapResolve())
.pipe(gulp.dest(deployPath))
})
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Alex Batalov
Inspired by borschik.
License
Copyright © 2015 Alex Batalov Licensed under the MIT license.