Skip to content

Commit 1436b9c

Browse files
committed
select and replace the whitespace before attribute to remove
1 parent f3c9923 commit 1436b9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tasks/compress_attributes.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,27 @@ var through = require('through2');
55
* of the plotly.js bundles
66
*/
77

8+
var WHITESPACE_BEFORE = '\\s*';
89
var OPTIONAL_COMMA = ',?';
910

1011
// one line string with or without trailing comma
1112
function makeStringRegex(attr) {
1213
return makeRegex(
13-
attr + ': \'.*\'' + OPTIONAL_COMMA
14+
WHITESPACE_BEFORE + attr + ': \'.*\'' + OPTIONAL_COMMA
1415
);
1516
}
1617

1718
// joined array of strings with or without trailing comma
1819
function makeJoinedArrayRegex(attr) {
1920
return makeRegex(
20-
attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA
21+
WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA
2122
);
2223
}
2324

2425
// array with or without trailing comma
2526
function makeArrayRegex(attr) {
2627
return makeRegex(
27-
attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA
28+
WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA
2829
);
2930
}
3031

0 commit comments

Comments
 (0)