Merge pull request #1533 from crazyserver/MOBILE-2626

MOBILE-2626 gulp: Admit single quotes in config.json
main
Juan Leyva 2018-09-25 15:34:36 +02:00 committed by GitHub
commit bfb6d8bbee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -251,8 +251,8 @@ gulp.task('config', function(done) {
for (var key in config) {
var value = config[key];
if (typeof value == 'string') {
// Wrap the string in ' .
value = "'" + value + "'";
// Wrap the string in ' and scape them.
value = "'" + value.replace(/([^\\])'/g, "$1\\'") + "'";
} else if (typeof value != 'number' && typeof value != 'boolean') {
// Stringify with 4 spaces of indentation, and then add 4 more spaces in each line.
value = JSON.stringify(value, null, 4).replace(/^(?: )/gm, ' ').replace(/^(?:})/gm, ' }');