3 ms·
Wouldn't it be possible to parse the list of commands used and only enable the JS libraries which are actually required?
by WillAdams 3y ago
Wouldn't it be possible to parse the list of commands used and only enable the JS libraries which are actually required?
- cscheid 3y agoFrankly, that's easier said than done. The complication is from the implied dependencies. If you've designed from zero to be able to track the requirements everywhere in the code base, then that's (in principle, though still not trivial) possible. But if you're looking to ship fast with a small team on the large feature set that we do have, then it's actually a better call to work on a system that has a fixed set of dependencies known in advance, and quickly iterate to solve other customer problems. tl;dr: tradeoffs. We chose one that still serves us well, but it does come with consequences.
- dragonstyle 3y agoWe do generally attempt to only include JS dependencies in the HTML output if they are used. We share those dependencies across pages in a website, so if a single page uses a dependency they all will pick it up, but if you have a minimal world view and disable the various interactive goodies, you should get a _relatively_ more thin set of dependencies. For HTML output, using `minimal: true` in document front matter will give you very minimal HTML that should be ready to style with CSS (and pretty much no dependencies)