broccoli-asset-rev
Advanced tools
| language: node_js | ||
| node_js: | ||
| - "0.12" | ||
| - "iojs" |
| console.log('Hello World'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| <!DOCTYPE html> | ||
| <html lang="en-us"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Application</title> | ||
| <link rel="stylesheet" href="/styles.css"> | ||
| <link rel="icon" href="/images/icons/favicon.png"> | ||
| </head> | ||
| <body> | ||
| <script type="text/javascript" src="/assets/application.js"></script> | ||
| <script type="text/javascript" src=/assets/application.js></script> | ||
| </body> | ||
| </html> |
| .sample-img { | ||
| width: 50px; | ||
| height: 50px; | ||
| background-image: url(images/sample.png); | ||
| } | ||
| .sample-img2 { | ||
| width: 50px; | ||
| height: 50px; | ||
| background-image: url('images/sample.png'); | ||
| } |
| console.log('Hello World'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
| <!DOCTYPE html> | ||
| <html lang="en-us"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Application</title> | ||
| <link rel="stylesheet" href="https://foobar.cloudfront.net/styles.css"> | ||
| <link rel="icon" href="https://foobar.cloudfront.net/images/icons/favicon.png"> | ||
| </head> | ||
| <body> | ||
| <script type="text/javascript" src="https://foobar.cloudfront.net/assets/application.js"></script> | ||
| <script type="text/javascript" src=https://foobar.cloudfront.net/assets/application.js></script> | ||
| </body> | ||
| </html> |
| .sample-img { | ||
| width: 50px; | ||
| height: 50px; | ||
| background-image: url(https://foobar.cloudfront.net/images/sample.png); | ||
| } | ||
| .sample-img2 { | ||
| width: 50px; | ||
| height: 50px; | ||
| background-image: url('https://foobar.cloudfront.net/images/sample.png'); | ||
| } |
@@ -24,3 +24,3 @@ var fs = require('fs'); | ||
| if (typeof options.customHash === 'function') { | ||
| this.customHash = null; | ||
| this.customHash = ''; | ||
| this.hashFn = options.customHash; | ||
@@ -59,6 +59,10 @@ } else { | ||
| Fingerprint.prototype.getDestFilePath = function (relativePath) { | ||
| if (Filter.prototype.getDestFilePath.apply(this, arguments)) { | ||
| var destFilePath = Filter.prototype.getDestFilePath.apply(this, arguments); | ||
| if (destFilePath) { | ||
| if (this.assetMap[relativePath]) { | ||
| return this.assetMap[relativePath]; | ||
| } | ||
| if (this.customHash === null) { | ||
| return this.assetMap[relativePath] = destFilePath; | ||
| } | ||
@@ -65,0 +69,0 @@ var tmpPath = path.join(this._srcDir, relativePath); |
+1
-1
| { | ||
| "name": "broccoli-asset-rev", | ||
| "version": "2.0.3", | ||
| "version": "2.0.4", | ||
| "description": "broccoli asset revisions (fingerprint)", | ||
@@ -5,0 +5,0 @@ "main": "lib/asset-rev.js", |
+9
-0
@@ -46,3 +46,12 @@ #broccoli-asset-rev | ||
| - `customHash` - Default: none - If set, overrides the md5 checksum calculation with the result of calling `customHash(buffer)`. If it is not a `function`, `customHash` is used as the hash value. | ||
| - `generateAssetMap` - Default: false. If true, will generate a `assetMap.json` file in a `assets` directory on the output tree. This file contains a mapping of the original asset name to the fingerprinted asset, like the following: | ||
| ```js | ||
| { | ||
| assets: { | ||
| css/file1.css: css/file1-sdaa7d6a87d6ada78ds.css, | ||
| images/image1.png: images/image1-sdaa7d6a87d6ada78ds.css, } | ||
| } | ||
| ``` | ||
| ## Ember CLI addon usage | ||
@@ -49,0 +58,0 @@ |
@@ -40,3 +40,3 @@ var fs = require('fs'); | ||
| var tree = assetRev(sourcePath + '/input', { | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif'], | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'], | ||
| replaceExtensions: ['html', 'js', 'css'] | ||
@@ -57,3 +57,3 @@ }); | ||
| var tree = assetRev(merged, { | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif'], | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'], | ||
| replaceExtensions: ['html', 'js', 'css'] | ||
@@ -72,3 +72,3 @@ }); | ||
| var tree = assetRev(sourcePath + '/input', { | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif'], | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'], | ||
| replaceExtensions: ['html', 'js', 'css'], | ||
@@ -84,2 +84,33 @@ prepend: 'https://foobar.cloudfront.net/' | ||
| it('skips fingerprint and prepends when set and customHash is null', function () { | ||
| var sourcePath = 'tests/fixtures/prepend'; | ||
| var tree = assetRev(sourcePath + '/input', { | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'], | ||
| replaceExtensions: ['html', 'js', 'css'], | ||
| prepend: 'https://foobar.cloudfront.net/', | ||
| customHash: null | ||
| }); | ||
| builder = new broccoli.Builder(tree); | ||
| return builder.build().then(function(graph) { | ||
| confirmOutput(graph.directory, sourcePath + '/output-customHash-null'); | ||
| }); | ||
| }); | ||
| it('skips fingerprint when customHash is null', function () { | ||
| var sourcePath = 'tests/fixtures/customHash-null'; | ||
| var tree = assetRev(sourcePath + '/input-output', { | ||
| extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map'], | ||
| replaceExtensions: ['html', 'js', 'css'], | ||
| customHash: null | ||
| }); | ||
| builder = new broccoli.Builder(tree); | ||
| return builder.build().then(function(graph) { | ||
| confirmOutput(graph.directory, sourcePath + '/input-output'); | ||
| }); | ||
| }); | ||
| it('replaces the correct match for the file extension', function () { | ||
@@ -86,0 +117,0 @@ var sourcePath = 'tests/fixtures/extensions'; |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
48129
16.24%79
16.18%458
12.53%74
13.85%