quarkiverse / quarkus-web-bundler

Create full-stack web apps quickly and easily with this Quarkus extension. It offers zero-configuration bundling for your web app scripts (JS, JSX, TS, TSX), dependencies (jQuery, React, htmx, etc.), and styles (CSS, SCSS, SASS).
Apache License 2.0
18 stars 10 forks source link

Introduce libraries support instead of auto-import #258

Open ia3andy opened 1 month ago

ia3andy commented 1 month ago

The auto-import feature is not yet documented and not default because a lot of libraries package.json is not enough to actually use the library out of the box.

Since the web-bundler is here to makes things easy for developers and bring sensible default to remove the hassle of looking for everything, I am thinking it could be nice to have something like we do in Quinoa with framework support but with libraries.

Library support would consist of declaring a name, a version range and a javascript code block in the web-bundler extension. This would be used when quarkus.quinoa.library-support=true and the given library is used.

ia3andy commented 1 month ago

@melloware @maxandersen @phillip-kruger @edewit any thoughts on this?

ia3andy commented 1 month ago

@gbourant that would make htmx 2.0 work out of the box with htmx extension support

ia3andy commented 1 month ago

Here is an example of what we would need to generate: https://github.com/ia3andy/one-two-three-quarkus/blob/main/dashboard/src/main/resources/web/app/app.js

ia3andy commented 1 month ago

Another option would be to have a documentation page containing how to use for libraries instead.. I am not sure what's the best here..

mkouba commented 1 month ago

Another option would be to have a documentation page containing how to use for libraries instead.. I am not sure what's the best here..

I think that it would be useful to have some kind of "compatibility list" for some popular libraries (bootstrap, htmx, fontawesome, etc.). And this list could contain some basic info. E.g. if quarkus.web-bundler.dependencies.auto-import=all works out-of-the-box. It does not have to be part of the docs, a github wiki page would be enough IMO.

melloware commented 1 month ago

I don't know how to implement it for Web Bundler but i will say adding Framework support has made Quinoa so much more developer friendly out of the box!