Commit 6c573391 authored by Timmy Willison's avatar Timmy Willison

Don't keep semicolons if the require call is not a var declaration

parent 49cfcb9f
...@@ -68,9 +68,9 @@ module.exports = function( grunt ) { ...@@ -68,9 +68,9 @@ module.exports = function( grunt ) {
// Remove CommonJS-style require calls // Remove CommonJS-style require calls
// Keep an ending semicolon // Keep an ending semicolon
contents = contents contents = contents
.replace( /(?:\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\1\s*\)([,;])/g, .replace( /(\s+\w+ = )?\s*require\(\s*(")[\w\.\/]+\2\s*\)([,;])/g,
function( all, quote, commaSemicolon ) { function( all, isVar, quote, commaSemicolon ) {
return commaSemicolon === ";" ? ";" : ""; return isVar && commaSemicolon === ";" ? ";" : "";
}); });
// Remove empty definitions // Remove empty definitions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment