• Resolved msalvatore

    (@msalvatore)


    I aim to integrate an animation library (gsap) into a Gutenberg block to render both in the frontend and the editor. While I successfully imported gsap into view.js for frontend rendering, I encountered difficulties achieving the same effect in the editor. Despite attempting to import gsap into edit.js and wrapping the animation script within a DOMContentLoaded event listener, I have not achieved the desired outcome. I also tried importing gsap in both editor.js and index.js and then setting the “script” key in block.json to point to the animation script (gsap).

Viewing 1 replies (of 1 total)
  • Thread Starter msalvatore

    (@msalvatore)

    Got this working by simply creating a file that imports gsap and contains the animation script, then referencing it in the “scripts” property in block.json.

Viewing 1 replies (of 1 total)

The topic ‘Integrating a js library into a block’ is closed to new replies.