broccoli-asset-rev
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -13,9 +13,13 @@ var Fingerprint = require('./fingerprint'); | ||
this.inputTree = inputTree; | ||
this.customHash = options.customHash; | ||
this.fingerprintExtensions = options.fingerprintExtensions || ['js', 'css', 'png']; | ||
this.replaceExtensions = options.replaceExtensions || ['html', 'css']; | ||
this.description = options.description; | ||
var fingerprintTree = Fingerprint(inputTree, { | ||
assetMap: this.assetMap, | ||
customHash: this.customHash, | ||
extensions: this.fingerprintExtensions, | ||
exclude: options.fingerprintExclude || [] | ||
exclude: options.fingerprintExclude || [], | ||
description: options.description | ||
}); | ||
@@ -26,3 +30,4 @@ | ||
extensions: this.replaceExtensions, | ||
prepend: options.prependPath || '' | ||
prepend: options.prependPath || '', | ||
description: options.description | ||
}); | ||
@@ -29,0 +34,0 @@ } |
@@ -16,4 +16,6 @@ var fs = require('fs'); | ||
this.assetMap = options.assetMap || {}; | ||
this.customHash = options.customHash; | ||
this.extensions = options.extensions || []; | ||
this.exclude = options.exclude || []; | ||
this.description = options.description; | ||
} | ||
@@ -48,9 +50,14 @@ | ||
var file = fs.readFileSync(tmpPath, { encoding: 'utf8' }); | ||
var hash; | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(file); | ||
var hex = md5.digest('hex'); | ||
if (this.customHash) { | ||
hash = this.customHash; | ||
} else { | ||
var md5 = crypto.createHash('md5'); | ||
md5.update(file); | ||
hash = md5.digest('hex'); | ||
} | ||
var ext = path.extname(relativePath); | ||
var newPath = relativePath.replace(ext, '-' + hex + ext); | ||
var newPath = relativePath.replace(ext, '-' + hash + ext); | ||
this.assetMap[relativePath] = newPath; | ||
@@ -57,0 +64,0 @@ |
@@ -14,2 +14,3 @@ var Filter = require('broccoli-filter'); | ||
this.prepend = options.prepend || ''; | ||
this.description = options.description; | ||
} | ||
@@ -16,0 +17,0 @@ |
{ | ||
"name": "broccoli-asset-rev", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "broccoli asset revisions (fingerprint)", | ||
@@ -5,0 +5,0 @@ "main": "lib/asset-rev.js", |
@@ -44,1 +44,2 @@ #broccoli-asset-rev | ||
- `prependPath` - Default: `''` - A string to prepend to all of the assets. Useful for CDN urls like `https://subdomain.cloudfront.net/` | ||
- `customHash` - Default: none - If defined, will be appended to filename instead of a md5 checksum. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8436
134
45