Idea: Make building "pages" vs "libraries" clever
xaviervia opened this issue · comments
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.
Sounds good, but what happens if the user defines a pages
config. Then we enforce it instead?
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.
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"