Open cybertheory opened 6 months ago
I think this would be mostly an issue for the server side rendering right? Because on the client you can use the standard web apis to modify the head (which is not controlled by jaspr on the client anyways).
Yea I think so. Just to clarify we can use the standard html library on client right? Jasper doesn't have client side features?
I mainly think this is important so devs don't have to deal as much with the native web files, especially devs who have never dealt with them before can use jasper ui libraries instead.
Just to clarify we can use the standard html library on client right?
Yes.
Jasper doesn't have client side features?
It does, but on a high level abstraction of things.
There is the analogy to flutter that most of the time its fine just using widgets, but if you want to, you can also use the custom painter and draw pixels yourself. For jaspr this low level control is using the dart:html library directly to modify the dom.
Do you have a concrete use-case in mind as an example? Its hard to design an feature without knowing what it would be used for exactly
Let's say this for example:
Jaspr aims to incorporate external component systems and libraries, currently, devs can install these libraries through dart pub
separately or copy and paste individual components. Since many of these packages will depend on external css/js they need to add these dependencies somewhere in the dom. End Developers will have to add these manually to the index.html or head parameter server-side.
There should be an easy, standardized install process that sets up the dependencies of the libraries within the Jaspr project. Exposing this hook to include dependencies at build time and/or creating functionality in the CLI for this during the addition of a dependency, will make this much more convenient.
Dev wants to install jaspr-material package
instead of adding dependencies in the dom, the jaspr-material package would declare the dependencies and the jaspr build
step would bundle the dependency references within the dom.
maybe this would necessiate some kind of jaspr pub
command for keeping track of dependencies?
another example would be if i wanted to add a font dependency, I could add it via jaspr include 'font'
for example. And, the build step would add it to an end dev's final site if they depend on my project's components.
Description
We need Util functions to add to the Document object, e.g if I want to add a script to head after Document is instantiated. Functions like these would be useful for 3rd party integrations and decrease setup for the end developer.
An example use case would be if I am creating a component library or need external dependencies, then the dev will need to make sure to add them to the index.html file or the Document object. We need some type of hook to be exposed so 3rd party packages can call these in the initState or build functions and these dependencies can go in the head section (or any other section) at build time.
Additional Context