Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web component approach #146

Open
Bilge opened this issue Aug 16, 2021 · 1 comment
Open

Web component approach #146

Bilge opened this issue Aug 16, 2021 · 1 comment

Comments

@Bilge
Copy link

Bilge commented Aug 16, 2021

Let me start by saying I don't understand what the purpose or benefit of this library is. I started off trying to use it and then just wrote my own webpack config. Since then, I've realised this bundle is entirely backwards. The front-end world is moving towards components à la Storybook and that's a good thing because it guarantees everything you see on a page can be reused. In order to achieve that, every little thing on a page, like a button, is a component and everything needed to render that component, including its appearance and behaviour, is packaged together. When a component is included, all its required CSS and/or JS is copied into the page automatically. How does this bundle facilitate web components? It doesn't. In fact, it's backwards because it tries to spit out a bunch of static pre-configured group of static asset files meaning you have to figure out - separately from whatever components you've included - which assets are needed for that page by yourself.

What is needed is a way to include lots of small Twig components - the building blocks of your front-end - and signal to webpack which ones we've included so it can automatically include the necessary assets for that page. Ideally, at compile time for a top-level Twig page, webpack should be collecting the list of component assets needed for that page and outputting a single resource to include on that page (or pair of resources, one for CSS and one for JS). I don't know if that's possible, but anything short of that doesn't seem particularly useful to me.

@Bilge
Copy link
Author

Bilge commented Oct 2, 2021

Related: symfony/webpack-encore#229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant