terrazzoapp / terrazzo

Use DTCG tokens in CI and code

Home Page:https://terrazzo.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to exclude meta object from build output

dev-nicolaos opened this issue · comments

Maybe I'm missing it, but from what I can tell the meta export in the output JS isn't used by anything else in the output. It does however, take up a huge amount of space. Our current build output's JS file is over 11,000 lines and the meta object is responsible for over 10,000 of them. This causes two issues:

  • Unless you have really sophisticated (this behavior might be more common than I originally thought) tree-shaking happening at the sub-file level in your bundler, that makes token code dramatically more expensive to send to a browser.
  • The updated dates in the metadata clutter the output when trying to review updates to the build output in Git (yes I know many workflows don't have include this, but ours does).

Since we aren't using the metadata, its a net negative for us. Having the option to exclude it from the build output would be really nice.

That’s fair! I had assumed that it was easily treeshakeable, but you’re right that may not always be the case. I’d be open to adding an option to plugin-js that just doesn’t generate this (just for backwards compat, though, it’d have to default to true in 1.0; can discuss whether it’s needed in plugin-js 2.x and beyond separately).

I can probably work on a PR for this

It appears this is already possible using the undocumented meta option. I guess my PR will just be documenting it and maybe adding a test

It appears this is already possible using the undocumented meta option

lol whoops I don’t even remember that existing! Good find 😆. Yes documentation would be gladly appreciated 🙏