Skip to content

Commit

Permalink
fix(bundle): support quoteless script src attribute
Browse files Browse the repository at this point in the history
Fixes #639

Makes the capture groups optional for single/double quotes in the source file regular expression.
  • Loading branch information
AustinBrunkhorst committed Jun 4, 2017
1 parent fd07344 commit ffafbc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ exports.escapeForRegex = function(str) {

exports.createSrcFileRegex = function() {
let parts = Array.prototype.slice.call(arguments);
let regexString = "\\b(?:src=(\"|')(.*))(";
let regexString = "\\b(?:src=(\"|')?(.*))(";
for (let i = 0; i < parts.length; i ++) {
regexString = regexString + exports.escapeForRegex(parts[i]) + (i < (parts.length - 1) ? '(\/|\\\\)' : '');
}
regexString = regexString + "(.*?).js)(?:(\"|'))";
regexString = regexString + "(.*?).js)(?:(\"|')?)";
return new RegExp(regexString);
};

Expand Down

0 comments on commit ffafbc9

Please sign in to comment.