dymosoftware / dymo-connect-framework

DYMO Connect Framework for Javascript.
Other
88 stars 54 forks source link

Reduce library size #23

Open trevdor opened 3 years ago

trevdor commented 3 years ago

This library makes label printing possible for my team's app. So thanks!

I'm wondering: Could we reduce the size of the library?

The last SDK available on developers.dymo.com (http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.3.0.js) was 103kb. The current version of dymo.connect.framework.js in this repo is 462kb.

I don't know the differences to fully appreciate why the change. But I'm seeing stuff in the version here that's defined but unused. For a quick few examples, in the goog.string namespace are the unused helpers toTitleCase, toSelectorCase, and toTitleCase.

Perhaps it could be converted to an ES Module, for instance, so folks could tree-shake out the parts they don't use?

I'd love to help with this effort. But it's been really difficult to do from the published version.

If my just-opened #22 happens, I'll be ready to jump in! I'll bet others would, too. Thanks!

giuliodamato commented 3 years ago

Can't really say I'm not accidentally part of this growth in size😂, the current version of the framework was merged from a fork of mine ... I had to pretty-print the code to introduce a fix to handle QR Codes dymosoftware/DCD-SDK-Sample#12

FYI, at the moment, my repo also contains a fix for a problem with the XML serialization of Color elements, if you wanna do some tests.

trevdor commented 3 years ago

Hey @giuliodamato, seems like you're helping, not hurting! I'm most curious about the switch to using Closure between 2018 & 2020, especially if accounts for most of the jump in code size. Looks like dymo.connect.framework.js was already up to ~340kb before you fixed up QR.

(Just a hunch, but those unused helpers I mentioned feel like Closure Compiler odds and ends to me.)