gulp-rev-replace
gulp-rev-replace copied to clipboard
Expose file to `modifyReved`/`modifyUnreved`
Hi, I am writing a task to support replace relative path. Below is my code snippet:
gulp.task('html', ['revision'], function () {
var manifest = gulp.src('.tmp/rev-manifest.json');
var srcPath = path.join(__dirname, 'app');
var revReplaceOptions = {};
revReplaceOptions.manifest = manifest;
function modifyDistPath(distPath, file) {
var fileRelativePath = path.relative(srcPath, file.path);
var fileDirname = path.dirname(fileRelativePath);
var distPathRelativePath = path.relative(fileDirname, distPath);
if (/^../.test(distPathRelativePath)) {
return distPathRelativePath
}
return distPath;
}
revReplaceOptions.modifyUnreved = modifyDistPath;
revReplaceOptions.modifyReved = modifyDistPath;
return gulp.src('app/**/*.html')
.pipe($.revReplace(revReplaceOptions))
.pipe(gulp.dest('dist'));
});
So I need the file.path as an argument to support the feature. The PR is to support this.
Thanks @crzidea. If you could update test.js to test for the new argument, I'd be happy to merge.
I will update test. And should I update README about this feature?
Yep, updating README would be great too, thanks.
I'm also having issues with relative paths and the rev-replace plugin, if this could be merged it would help me a lot. Can I help moving this forward?
@ankon Yes, please! I will be grateful if you can take over this!