I've recently learned about Web Components (sorry I'm late, i'm not a pro developer :)) and, well, they are quite awesome.

For the plugin i'm coding, I need a menu exactly like this one, @polymer/paper-menu-button.

Since it already exists as a web component, which should I loose my time coding my own ? :)

  • What I see is that a lot of people have been talking about them, but maybe the hype has fallen back ? (a lot of google entries were published in 2017, not so much today)
  • I had a try (non-conclusive for now), did install the dependencies using Yarn, but well, it is 2.6 Mo of files for a... menu, which is a lot ! I also have to register several JS files in my plugin; which are still more files to load.

Well, I was wondering if it was a good practice to use web components in Wordpress development, and if you had advices or comments about that.

Thanks !

  • 1
    Something to consider, if you planned on using this for a WordPress menu, is that whatever time you saved scripting (or finding a regular JS script) you would need to spend to develop an entirely custom menu walker in PHP to output menus with the required markup. – Jacob Peattie Jul 4 at 8:37
  • I would save time, of course... But it will require dependencies, etc, and I don't see much entries about that topic on internet (WP + custom elements) – gordie Jul 4 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.