Skip to content

Enable compress attributes browserify transform by default #1584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
},
"browserify": {
"transform": [
"glslify"
"glslify",
"./tasks/compress_attributes.js"
]
},
"dependencies": {
Expand Down Expand Up @@ -101,7 +102,7 @@
},
"devDependencies": {
"brfs": "^1.4.3",
"browserify": "^14.1.0",
"browserify": "^14.3.0",
"browserify-transform-tools": "^1.7.0",
"deep-equal": "^1.0.1",
"ecstatic": "^2.1.0",
Expand Down
3 changes: 2 additions & 1 deletion tasks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ _bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist,
// Browserify the plotly.js with meta
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, {
standalone: 'Plotly',
debug: DEV
debug: DEV,
noCompress: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

});

// Browserify the plotly.js partial bundles
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions tasks/util/browserify_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var browserify = require('browserify');
var UglifyJS = require('uglify-js');

var constants = require('./constants');
var compressAttributes = require('./compress_attributes');
var patchMinified = require('./patch_minified');

/** Convenience browserify wrapper
Expand Down Expand Up @@ -38,7 +37,10 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts) {
var browserifyOpts = {};
browserifyOpts.standalone = opts.standalone;
browserifyOpts.debug = opts.debug;
browserifyOpts.transform = outputMinified ? [compressAttributes] : [];

if(opts.noCompress) {
browserifyOpts.ignoreTransform = './tasks/compress_attributes.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 This seems better by default, and tasks/ seems like a better location than tasks/util

}

var b = browserify(pathToIndex, browserifyOpts),
bundleWriteStream = fs.createWriteStream(pathToBundle);
Expand Down
2 changes: 0 additions & 2 deletions tasks/util/watchified_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var prettySize = require('prettysize');

var constants = require('./constants');
var common = require('./common');
var compressAttributes = require('./compress_attributes');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that this just disappears. Opt-opt also scopes the transform better so it doesn't need to be applied globally 👍


/**
* Make a plotly.js browserify bundle function watched by watchify.
Expand All @@ -22,7 +21,6 @@ module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
var b = browserify(constants.pathToPlotlyIndex, {
debug: true,
standalone: 'Plotly',
transform: [compressAttributes],
cache: {},
packageCache: {},
plugin: [watchify]
Expand Down