Enable compress attributes browserify transform by default#1584
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:
|
| browserifyOpts.transform = outputMinified ? [compressAttributes] : []; | ||
|
|
||
| if(opts.noCompress) { | ||
| browserifyOpts.ignoreTransform = './tasks/compress_attributes.js'; |
There was a problem hiding this comment.
👏 This seems better by default, and tasks/ seems like a better location than tasks/util
|
|
||
| var constants = require('./constants'); | ||
| var common = require('./common'); | ||
| var compressAttributes = require('./compress_attributes'); |
There was a problem hiding this comment.
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
| standalone: 'Plotly', | ||
| debug: DEV | ||
| debug: DEV, | ||
| noCompress: true |
|
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
ignoreTransformbrowserify options with can still producedist/plotly-with-meta.jsas before.TODO:
compress_attributes.jstransform 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.json npm and refer to it as a dependency innode_modules/like we currently do forglslify.plotschema_test.jssuite tobundle_tests/and make it useplotly-with-meta.jscc @rreusser