mariusbalcytis / webpack-bundle

Bundle to Integrate Webpack into Symfony
MIT License
122 stars 36 forks source link

Added small benefit of the hostnet/webpack bundle #26

Closed linaori closed 7 years ago

linaori commented 7 years ago

I think it's good to have alternatives, but the best feature of the hostnet/webpack bundle was not listed (note that I still prefer to run it without Symfony integration at all). This is one feature that makes it really great to use but might not be the deciding factor.

mariusbalcytis commented 7 years ago

Just to be sure - you're referring to ability to provide inline javascript inside twig template, which will be compiled and inserted as link to that generated file?

Personally I don't quite understand "simple splitpoints per file" term.

Just out of curiosity - what is the use case for this? Just to have styles together with markup in a single file or is there something else there?

linaori commented 7 years ago

@mariusbalcytis Basically what makes webpack powerful, is that you can define splitpoints, files that have their own entry point, which you can say "At this point, I only want to initiate this and require that": https://github.com/hostnet/webpack-bundle#more-about-the-inline-variant. You can have a page where you require an extra bit of javascript, which will only be loaded on that specific page.

mariusbalcytis commented 7 years ago

Well, yeah, but it's the same as if I'd add the inlined content into a separate javascript file and require it using <script src="webpack_asset('path/to/file.js')"></script>. The resulting HTML would still have <script> tag in that place where {% webpack inline %} was defined.

Or is this somehow different?

linaori commented 7 years ago

The idea is that the inline tag extracts the javascript/css inside and extracts it to a new file registered in webpack, the src is then added to the place where the rest is included as well (small automation part).