saguijs / sagui

:monkey: Front-end tooling in a single dependency
http://sagui.js.org/
MIT License
669 stars 32 forks source link

Idea: Make building "pages" vs "libraries" clever #396

Open xaviervia opened 6 years ago

xaviervia commented 6 years ago

A page is really just a .js file that happens to have an .html file with the exact same name and path. Any file in such situation could be automatically an entrypoint.

That way, there would be no need for pages configuration any more: when starting up, Sagui would read the file tree within src and whenever a .js file is found with a matching .html file, it will build a page.

Building libraries still requires configuration for UMD, so the libraries configuration option can be kept.

pirelenito commented 6 years ago

Sounds good, but what happens if the user defines a pages config. Then we enforce it instead?

xaviervia commented 6 years ago

I think that's an option, for backwards compatibility.

The other option is to ignore it. I think that is also a valid option: existing users will have an .html file for every page anyway, since it is required by Sagui. If there is an .html file in the src folder without a corresponding .js file, Sagui could just serve that .html file. I don’t imagine this creating any issues, on the contrary.

xaviervia commented 6 years ago

If we deprecate it, when Sagui finds a pages entry in the config it could log a note "pages config is no longer required, pages are now detected automatically from .html files"