MOBILE-2626 gulp: Admit single quotes in config.json

main
Pau Ferrer Ocaña 2018-09-25 08:41:38 +02:00
parent cba29471d8
commit 18e2012f89
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) { for (var key in config) {
var value = config[key]; var value = config[key];
if (typeof value == 'string') { if (typeof value == 'string') {
// Wrap the string in ' . // Wrap the string in ' and scape them.
value = "'" + value + "'"; value = "'" + value.replace(/([^\\])'/g, "$1\\'") + "'";
} else if (typeof value != 'number' && typeof value != 'boolean') { } else if (typeof value != 'number' && typeof value != 'boolean') {
// Stringify with 4 spaces of indentation, and then add 4 more spaces in each line. // 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, ' }'); value = JSON.stringify(value, null, 4).replace(/^(?: )/gm, ' ').replace(/^(?:})/gm, ' }');