-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Enable compress attributes browserify transform by default #1584
Conversation
- 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
Apologies I missed in the first place, but I wholeheartedly support this. The only exception would be if it makes it difficult to compile with metadata. So my question is: how do you compile with metadata when this is present? |
Oh, just saw linked comment:
|
tasks/util/browserify_wrapper.js
Outdated
browserifyOpts.transform = outputMinified ? [compressAttributes] : []; | ||
|
||
if(opts.noCompress) { | ||
browserifyOpts.ignoreTransform = './tasks/compress_attributes.js'; |
There was a problem hiding this comment.
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
@@ -6,7 +6,6 @@ var prettySize = require('prettysize'); | |||
|
|||
var constants = require('./constants'); | |||
var common = require('./common'); | |||
var compressAttributes = require('./compress_attributes'); |
There was a problem hiding this comment.
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 👍
tasks/bundle.js
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Apologies I didn't leave more meaningful feedback the first time around. This definitely seems like a good idea. It's really the exception rather than the norm that you'd even want the extra metadata. It looks like it needs a quick refresh to resolve a conflict or two, but assuming that's just trivial merging, it gets the 💃 from me. Edit: and pending windows check. |
Can anyone with a window laptop try running Maybe @dfcreative could help. |
... where we ignore the compress_attributes.js transform on bundling.
Ping @antoinerg (who has access to a Windows "dev" 💻 ) Could you pull down this branch and run To check that things work:
i.e. only three occurrences of
Thanks! |
@etpinard: I confirm that things work on my Windows 10 machine 🎉 |
Fantastic! Attribute meta will be stripped out of bundles (made with bundlers that support browserify transforms) by default starting in |
as discussed in rreusser/plotly-mock-viewer#5 (comment), we should really be compressing our attribute declarations in all browserify builds by default - to make sure that customs bundles don't include (useless) attribute description strings.
Note that, using the
ignoreTransform
browserify options with can still producedist/plotly-with-meta.js
as before.TODO:
compress_attributes.js
transform using a relative (UNIX) path. We should make sure that this works also on Windows machines before merging. If that doesn't work we can always publishcompress_attributes.js
on npm and refer to it as a dependency innode_modules/
like we currently do forglslify
.plotschema_test.js
suite tobundle_tests/
and make it useplotly-with-meta.js
cc @rreusser