Socket
Book a DemoInstallSign in
Socket

gulp-rev-sri

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-rev-sri

A gulp-rev subresource integrity plugin

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
19
5.56%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-rev-sri

build status code coverage code style styled with prettier made with lass license npm downloads

A gulp-rev subresource integrity plugin

Table of Contents

Install

npm:

npm install gulp-rev-sri

yarn:

yarn add gulp-rev-sri

Usage

const gulp = require('gulp');
const rev = require('gulp-rev');
const revSri = require('gulp-rev-sri');

gulp.src('./myassets/**/*')
  .pipe(rev())
  .pipe(gulp.dest('./somedestination/'))
  .pipe(rev.manifest())
  .pipe(revSri({ base: 'some/build/path', manifestName: 'sri-manifest.json' }))
  .pipe(gulp.dest('./somedestination/'))
  .on('end', () => { ... });

// sri-manifest.json
// { <original_file>: { path: <file_with_rev_hash>, integrity: 'sha256-<hash_of_file>' } }

Options

  • base - base file path for build files
  • manifestName (default: sri-manifest.json) - name of the manifest file being created (Warning do not use rev-manifest.json)

Warning: The original rev-manifest.json is in the format:

{
  "<file_path>": "<rev_file_path>",
  "<file_path>": "<rev_file_path>"
  ...
}

while the new sri format couples a file path with it's integrity hash in the new format of:

{
  "<file_path>": {
    "path": "<rev_file_path>",
    "integrity": "sha256-<hash_of_file_as_base64_encoded>"
  },
  "<file_path>": {
    "path": "<rev_file_path>",
    "integrity": "sha256-<hash_of_file_as_base64_encoded>"
  },
  ...
}

It's recommended that you choose a different file name from rev-manifest.json due to potential complications in merging existing files.

Contributors

NameWebsite
Shaunhttps://shaunwarman.com

License

MIT © Shaun

Keywords

gulp-rev-sri

FAQs

Package last updated on 20 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts