Home

Awesome

broccoli-asset-rev

Build Status codecov.io npm

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

npm install broccoli-asset-rev --save-dev

Usage

var AssetRev = require('broccoli-asset-rev');

var assetNode = new AssetRev(node, {
  extensions: ['js', 'css', 'png', 'jpg', 'gif'],
  exclude: ['fonts/169929'],
  replaceExtensions: ['html', 'js', 'css'],
  prepend: 'https://subdomain.cloudfront.net/'
});

Options

{
	assets: {
		css/file1.css: css/file1-sdaa7d6a87d6ada78ds.css,
		images/image1.png: images/image1-sdaa7d6a87d6ada78ds.css,
	}
}

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

var app = new EmberApp({
  fingerprint: {
    exclude: ['fonts/169929'],
    prepend: 'https://sudomain.cloudfront.net/'
  }
});

Ember CLI addon options

ghit.me

Contributors

Originally authored by @rickharrison