Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the option to specify files that need a third pass of UseRev #137

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/asset-rev.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ function AssetRev(inputTree, options) {
var assetRewrite = UseRev(fingerprintTree, this);

// second pass - fingerprints replaceable source code
this.exclude = exclude;
this.exclude = exclude.slice();
if (options.filesForThirdPass) {
this.exclude = this.exclude.concat(options.filesForThirdPass);
}
this.onlyHash = this.replaceExtensions;
var fingerprintTree2 = Fingerprint(assetRewrite, this);
var assetRewrite2 = UseRev(fingerprintTree2, this);

return new FastbootManifestRewrite(assetRewrite2, this.assetMap);
// Some files may need to be hashed until the third
// pass since they contain references to other files that are fingerprinted
if (options.filesForThirdPass) {
this.exclude = exclude;
this.onlyHash = options.filesForThirdPass;
var fingerprintTree3 = Fingerprint(assetRewrite2, this);
var assetRewrite3 = UseRev(fingerprintTree3, this);
}

return new FastbootManifestRewrite(assetRewrite3 || assetRewrite2, this.assetMap);
}

module.exports = AssetRev;