Skip to content

Commit 3485c0e

Browse files
committed
add compress_attributes.js transform to "browserify" field
- so that it is enabled by default on browserify builds - mv it to `./tasks/` for better discoveribility - ignore it when bundling plotly-with-meta.js bundle - 🔪 other refs to compress_attributes.js
1 parent 74f9f39 commit 3485c0e

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
},
5050
"browserify": {
5151
"transform": [
52-
"glslify"
52+
"glslify",
53+
"./tasks/compress_attributes.js"
5354
]
5455
},
5556
"dependencies": {

tasks/bundle.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ _bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist,
4141
// Browserify the plotly.js with meta
4242
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, {
4343
standalone: 'Plotly',
44-
debug: DEV
44+
debug: DEV,
45+
noCompress: true
4546
});
4647

4748
// Browserify the plotly.js partial bundles
File renamed without changes.

tasks/util/browserify_wrapper.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var browserify = require('browserify');
55
var UglifyJS = require('uglify-js');
66

77
var constants = require('./constants');
8-
var compressAttributes = require('./compress_attributes');
98
var patchMinified = require('./patch_minified');
109

1110
/** Convenience browserify wrapper
@@ -38,7 +37,10 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts) {
3837
var browserifyOpts = {};
3938
browserifyOpts.standalone = opts.standalone;
4039
browserifyOpts.debug = opts.debug;
41-
browserifyOpts.transform = outputMinified ? [compressAttributes] : [];
40+
41+
if(opts.noCompress) {
42+
browserifyOpts.ignoreTransform = './tasks/compress_attributes.js';
43+
}
4244

4345
var b = browserify(pathToIndex, browserifyOpts),
4446
bundleWriteStream = fs.createWriteStream(pathToBundle);

tasks/util/watchified_bundle.js

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var prettySize = require('prettysize');
66

77
var constants = require('./constants');
88
var common = require('./common');
9-
var compressAttributes = require('./compress_attributes');
109

1110
/**
1211
* Make a plotly.js browserify bundle function watched by watchify.
@@ -22,7 +21,6 @@ module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
2221
var b = browserify(constants.pathToPlotlyIndex, {
2322
debug: true,
2423
standalone: 'Plotly',
25-
transform: [compressAttributes],
2624
cache: {},
2725
packageCache: {},
2826
plugin: [watchify]

0 commit comments

Comments
 (0)