Fork of gulp-rev-replace.
Gulp plugin to rewrite occurrences of RequireJS modules which have been renamed by gulp-rev.
$ npm install --save-dev gulp-rev-replace-amd
Pipe through a stream which has both the files you want to be updated, as well as the files which have been renamed.
var gulp = require('gulp');
var filter = require('gulp-filter');
var rev = require('gulp-rev');
var revReplaceAmd = require('gulp-rev-replace-amd');
var revFilter = filter('**/*.{js,hbs}');
return gulp.src([
'app/**/*.{js,hbs,html}',
'.tmp/**/*.*' // take care to NOT include directories !!
])
.pipe(revFilter)
.pipe(rev())
.pipe(revFilter.restore())
// RJS assets need to be rev-replaced w/o .js extension
.pipe(revReplaceAmd({
replaceBasePath: 'assets' // <- set to 'require.config.baseUrl'
}))
.pipe(gulp.dest('dist'));
});
Type: boolean
Default: true
Use canonical URIs when replacing paths; e.g., when working with paths with non-forward-slash (/
) path separators, replace with forward slashes.
Type: String
Default: ''
Base path of assets; ignored during replacements. Set this to your RequireJS config's baseUrl.
Type: Array
Default: ['.js', '.html', '.hbs']
Only substitute reved filenames in files of these types.
Type: Array
Default: ['.js']
Replace references to these types of files, even when those references lack a file extension.
Type: boolean
Default: true
Don't replace filenames in the replaceBasePath (no subpath).
!! WARNING !! Be wary of disabling this setting, as it can significantly increase the likelihood of erroneous string replacements.
- Update test cases