JSPM

gulp-hash-references

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34
  • Score
    100M100P100Q74702F

Replaces references (paths) to files according to the specified mapping file.

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.

Usage

var hash = require('gulp-hash'),
    references = require('gulp-hash-references');

gulp.src('css/styles.css')
    .pipe(hash()) // Generate a hash for styles.css and rename it
    .pipe(gulp.dest('css')) // Save the renamed styles.css (now something like styles.abc123df.css)
    .pipe(hash.manifest('style-manifest.json')) // Retrieve the generated manifest for styles.css with an optional filename for saving
    .pipe(gulp.dest('.')) // Save the manifest file (optional)
    .pipe(references(gulp.src('index.html'))) // Pipe the manifest and pass a gulp.src of files to update references in (only index.html in this example)
    .pipe(gulp.dest('.')); // Save the updated index.html

You can also generate the manifest file(s) in advance and then just:

gulp.src('asset-manifests/**/*.json')
    .pipe(references(gulp.src('index.html')))
    .pipe(gulp.dest('.'));