Lets say that I want to make a block with animations from an external library as GSAP.
I have this file structure (files not needed omitted):
my-blocks-plugin │ └─ blocks │ └─ my-block-1 │ ├─ block.json │ ├─ index.js │ ├─ edit.js │ └─ save.js │ └───── package.json my-theme │ └─ app.js (imported GSAP as a module) │ └───── package.json (it includes GSAP)
I have imported GSAP as a module in my theme inside
my-theme/app.js for theme animations.
The main question is, for use GSAP in a block:
Should I use the GSAP in the theme? If yes, the plugin will be theme dependent.
Should I include GSAP in the
If yes: It doesn’t matter that the library is redundant with the theme’s library?
Also, will the library be loaded every time a block is included in the editor? (Many blocks = many redundant libraries)