Skip to content

Commit

Permalink
Fix config generation when minifying (Modernizr#2657)
Browse files Browse the repository at this point in the history
Co-authored-by: rejas <github@veeck.de>
  • Loading branch information
t3chguy and rejas authored Aug 17, 2021
1 parent efde16b commit 313a7ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ function build(generate, generateBanner, pkg) {
}
['enableClasses', 'enableJSClass', 'usePrefixes'].forEach(function(configName) {
if (config && typeof config[configName] === 'boolean') {
output = output.replace(new RegExp('(' + configName + '\\\'?\\s?:\\s?)(true|false)([,\\n])'), '$1' + Boolean(config[configName]) + '$3');
if (config.minify) {
output = output.replace(new RegExp('(' + configName + '\\\'?\\s?:\\s?)(!?0)([,\\n])'), '$1' + (config[configName] ? "!0" : "!1") + '$3');
} else {
output = output.replace(new RegExp('(' + configName + '\\\'?\\s?:\\s?)(true|false)([,\\n])'), '$1' + Boolean(config[configName]) + '$3');
}
}
});

Expand Down

0 comments on commit 313a7ad

Please sign in to comment.