Package Exports
- gulp-hash-references
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-hash-references) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gulp-hash-references
Replaces references (paths) to files according to the specified mapping file. Designed to be used with gulp-hash.
NOTE TO USERS UPGRADING FROM 1.x
The API of the plugin has changed significantly. Files where the references are to be updated should now be piped to the plugin, with the first argument being the path to the manifest file. See updated usage examples and API below.
Usage
var hash = require('gulp-hash');
var references = require('gulp-hash-references');
gulp.task('styles', function() {
return gulp.src('styles/**/*.css')
.pipe(hash()) // Generate hashes for the CSS files
.pipe(gulp.dest('dist')) // Save the renamed CSS files (e.g. style.123456.css)
.pipe(hash.manifest('asset-manifest.json')) // Generate a manifest file
.pipe(gulp.dest('.')); // Save the manifest file
});
gulp.task('update-references', function() {
return gulp.src('index.html')
.pipe(references('asset-manifest.json')) // Replace file paths in index.html according to the manifest
.pipe(gulp.dest('.'));
});Streaming
This plugin does not support streaming. Please convert streaming vinyl files to buffers first using something like vinyl-buffer.
API
references(manifestPath[, options])
manifestPath
Type: String or String[]
Path to the manifest file, or an array of paths if using multiple manifest files.
options
Type: Object
options.dereference
Type: boolean
Default: false
If set to true, the plugin's functionality is reversed and the replaced file paths are reverted to the original path instead.