Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
Installations
npm install broccoli-asset-rev
Releases
Unable to fetch releases
Developer
rickharrison
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
10.4.0
NPM Version
6.1.0
Statistics
86 Stars
185 Commits
83 Forks
9 Watching
2 Branches
41 Contributors
Updated on 15 Aug 2024
Bundle Size
204.15 kB
Minified
61.97 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
47,506,753
Last day
-30.8%
16,768
Compared to previous day
Last week
-15%
100,898
Compared to previous week
Last month
15.4%
496,567
Compared to previous month
Last year
-10.6%
5,745,714
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
broccoli-asset-rev
Broccoli plugin to add fingerprint checksums to your files and update the source to reflect the new filenames.
Turns
<script src="assets/appname.js">
background: url('/images/foo.png');
Into
<script src="https://subdomain.cloudfront.net/assets/appname-342b0f87ea609e6d349c7925d86bd597.js">
background: url('https://subdomain.cloudfront.net/images/foo-735d6c098496507e26bb40ecc8c1394d.png');
Installation
1npm install broccoli-asset-rev --save-dev
Usage
1var AssetRev = require('broccoli-asset-rev'); 2 3var assetNode = new AssetRev(node, { 4 extensions: ['js', 'css', 'png', 'jpg', 'gif'], 5 exclude: ['fonts/169929'], 6 replaceExtensions: ['html', 'js', 'css'], 7 prepend: 'https://subdomain.cloudfront.net/' 8});
Options
extensions
- Default:['js', 'css', 'png', 'jpg', 'gif', 'map']
- The file types to add md5 checksums.exclude
- Default:[]
- An array of globs. If a filename contains any item in the exclude array, it will not be fingerprinted.replaceExtensions
- Default:['html', 'css', 'js']
- The file types to replace source code with new checksum file names.prepend
- Default:''
- A string to prepend to all of the assets. Useful for CDN urls likehttps://subdomain.cloudfront.net/
generateRailsManifest
- Default: none - If true, will generate amanifest.json
to be used by Sprockets for the Rails Asset Pipeline. The manifest will be fingerprinted by default but this can be avoided by adding'manifest.json'
to theexclude
list.railsManifestPath
- Default:'assets/manifest-HASH.json'
- The path in the destination folder to store the Rails manifest. Only for the default value,HASH
will be replace with the fingerprint of the file.customHash
- Default: none - If set, overrides the md5 checksum calculation with the result of callingcustomHash(buffer, pathToFile)
. If it is not afunction
,customHash
is used as the hash value. If it is set tonull
, fingerprinting is skipped and only prepending occurs.generateAssetMap
- Default: false. If true, will generate aassetMap.json
file in aassets
directory on the output node. This file contains a mapping of the original asset name to the fingerprinted asset, like the following:assetMapPath
- Default:'assets/assetMap-HASH.json'
- The path in the destination folder to store theassetMap.json
in. Only for the default value,HASH
will be replace with the fingerprint of the file.
1{ 2 assets: { 3 css/file1.css: css/file1-sdaa7d6a87d6ada78ds.css, 4 images/image1.png: images/image1-sdaa7d6a87d6ada78ds.css, 5 } 6}
fingerprintAssetMap
- Default: false. If true, will fingerprintassetMap.json
.ignore
- Default:[]
- An array of strings. If a filename contains any item in the ignore array, the contents of the file will not be processed for fingerprinting.annotation
- Default: null. A human-readable description for this plugin instance.
Default settings
The default settings are available if needed in your application or addon via:
var broccoliAssetRevDefaults = require( 'broccoli-asset-rev/lib/default-options' );
Ember CLI addon usage
1var app = new EmberApp({
2 fingerprint: {
3 exclude: ['fonts/169929'],
4 prepend: 'https://sudomain.cloudfront.net/'
5 }
6});
Ember CLI addon options
enabled
- Default:app.env === 'production'
- Boolean. Enables fingerprinting if true. True by default if current environment is production.exclude
- Default:[]
- An array of globs. If a filename contains any item in the exclude array, it will not be fingerprinted.extensions
- Default:['js', 'css', 'png', 'jpg', 'gif', 'map']
- The file types to add md5 checksums.prepend
- Default:''
- A string to prepend to all of the assets. Useful for CDN urls likehttps://subdomain.cloudfront.net/
replaceExtensions
- Default:['html', 'css', 'js']
- The file types to replace source code with new checksum file names.
Contributors
Originally authored by @rickharrison
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 8/16 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Score
3.7
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More