gulp-rev-amp
v0.1.6
Published
copy from `gulp-rev` but fix excute [.js]-[.map] in manifest when use gulp-sourcemaps
Downloads
3
Maintainers
Readme
Install
$ npm install --save-dev gulp-rev-amp
API
you can goto https://www.npmjs.com/package/gulp-rev to see how to use [gulp-rev]
rev()
rev.manifest([path], [options])
path
Type: string
Default: "rev-manifest.json"
Manifest file path.
options
base
Type: string
Default: process.cwd()
Override the base
of the manifest file.
cwd
Type: string
Default: process.cwd()
Override the cwd
(current working directory) of the manifest file.
merge
Type: boolean
Default: false
Merge existing manifest file.
ignore
Type: function
Default: false
do sth to ignore files with filepath.
transformer
Type: object
Default: JSON
An object with parse
and stringify
methods. This can be used to provide a
custom transformer instead of the default JSON
for the manifest file.
Original path
Original file paths are stored at file.revOrigPath
. This could come in handy for things like rewriting references to the assets.
Asset hash
The hash of each rev'd file is stored at file.revHash
. You can use this for customizing the file renaming, or for building different manifest formats.
you can goto https://www.npmjs.com/package/gulp-rev to see how to use [gulp-rev]
Asset manifest
var gulp = require('gulp')
sourcemaps = require('gulp-sourcemaps'),
rev = require('gulp-rev-amp');
gulp.task('default', function () {
// by default, gulp would pick `assets/css` as the base,
// so we need to set it explicitly:
return gulp.src(['assets/css/*.css', 'assets/js/*.js'], {base: 'assets'})
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rev())
.pipe(sourcemaps.write('maps'))
.pipe(rev.manifest({
merge: true,
ignore:function(filepath){
var ext = filepath.slice(filepath.lastIndexOf('.'));
return ext === '.map'
}
}))
.pipe(gulp.dest('build/assets'));
});
Integration
For more info on how to integrate gulp-rev-amp into your app, have a look at the integration guide.
License
MIT © Sindre Sorhus