Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b854d61

Browse files
authored
Merge pull request #5439 from plotly/compress-headers
Avoid redundant plotly.js copyright comments in bundles
2 parents f8f08cf + cf4133d commit b854d61

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"browserify": {
5555
"transform": [
5656
"glslify",
57+
"./tasks/compress_headers.js",
5758
"./tasks/compress_attributes.js"
5859
]
5960
},

‎tasks/compress_headers.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var through = require('through2');
2+
3+
var licenseSrc = require('./util/constants').licenseSrc
4+
.replace(/\//g, '\\/')
5+
.replace(/\*/g, '\\*')
6+
.replace(/\n/g, '[^]');
7+
8+
/**
9+
* Browserify transform that strips redundant plotly.js Copyright comments out
10+
* of the plotly.js bundles
11+
*/
12+
13+
var WHITESPACE_BEFORE = '\\s*';
14+
15+
module.exports = function() {
16+
var allChunks = [];
17+
return through(function(chunk, enc, next) {
18+
allChunks.push(chunk);
19+
next();
20+
}, function(done) {
21+
var str = Buffer.concat(allChunks).toString('utf-8');
22+
this.push(
23+
str.replace(new RegExp(WHITESPACE_BEFORE + licenseSrc, 'g'), '')
24+
);
25+
done();
26+
});
27+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /