Closed
Description
PyScript currently "requires" users to load the CSS explicitly and separately from the JS. This has a few limitations:
- locks the flexibility of customizing style
- forces to load all the styles before the JS logic itself (adding up to the loading time, even if just a little)
- not friendly to support theming
- users have to specify 2 cmds to load PyScript on their pages (link to CSS and script to js)
If we switch to lading CSS dynamically within the scope of pyscript.js we can:
- have a default global style that loads if not stylesheet or theme has been specified
- allow users to create stylesheets/themes on their own that can be used instead of the default one
- have more control over what's being loaded into the page and when
- reduce the amounts of steps needed for a user to start using PyScript
In terms of implementation, we could allow users to specify a theme for the app in the AppConfig yaml that can be loaded in runtime.
Would love to hear opinions about the good and bad of the different approaches and possible alternative solutions. :)