diff --git a/tasks/compress_attributes.js b/tasks/compress_attributes.js index 139086e8900..b2f43e7e5d4 100644 --- a/tasks/compress_attributes.js +++ b/tasks/compress_attributes.js @@ -5,25 +5,27 @@ var through = require('through2'); * of the plotly.js bundles */ +var WHITESPACE_BEFORE = '\\s*'; +var OPTIONAL_COMMA = ',?'; // one line string with or without trailing comma function makeStringRegex(attr) { return makeRegex( - attr + ': \'.*\'' + ',?' + WHITESPACE_BEFORE + attr + ': \'.*\'' + OPTIONAL_COMMA ); } // joined array of strings with or without trailing comma function makeJoinedArrayRegex(attr) { return makeRegex( - attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + ',?' + WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA ); } // array with or without trailing comma function makeArrayRegex(attr) { return makeRegex( - attr + ': \\[[\\s\\S]*?\\]' + ',?' + WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA ); }