Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bundle assets from dependencies #151

Open
cybertheory opened this issue Jan 8, 2024 · 9 comments
Open

feat: bundle assets from dependencies #151

cybertheory opened this issue Jan 8, 2024 · 9 comments
Labels

Comments

@cybertheory
Copy link
Contributor

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

@cybertheory cybertheory changed the title feat: feat: Util functions to add to the Document objec Jan 8, 2024
@cybertheory cybertheory changed the title feat: Util functions to add to the Document objec feat: Util functions to add to the Document object Jan 8, 2024
@schultek
Copy link
Owner

schultek commented Jan 9, 2024

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).

@cybertheory
Copy link
Contributor Author

Yea I think so. Just to clarify we can use the standard html library on client right? Jasper doesn't have client side features?

@cybertheory
Copy link
Contributor Author

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.

@schultek
Copy link
Owner

schultek commented Jan 9, 2024

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.

@schultek
Copy link
Owner

schultek commented Jan 9, 2024

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

@cybertheory
Copy link
Contributor Author

cybertheory commented Jan 9, 2024

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.

@cybertheory
Copy link
Contributor Author

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.

@cybertheory
Copy link
Contributor Author

maybe this would necessiate some kind of jaspr pub command for keeping track of dependencies?

@cybertheory
Copy link
Contributor Author

cybertheory commented Jan 9, 2024

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.

@schultek schultek changed the title feat: Util functions to add to the Document object feat: bundle assets from dependencies Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants