Skip to content

How to create additional packages for Plenti? #216

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

Open
Fankhauser-Dominik opened this issue Sep 22, 2022 · 3 comments
Open

How to create additional packages for Plenti? #216

Fankhauser-Dominik opened this issue Sep 22, 2022 · 3 comments

Comments

@Fankhauser-Dominik
Copy link

I wanted to create a Masonry Gallery with Photoswipe Lightbox support:
Svelte Photoswipe Gallery
How can I convert this into a Plenti conform Package? I'm a little bit lost about how to get that working. I would appreciate it, if someone could help me.
It would be cool if we could have some guidance on how to properly write a package, to be used with Plenti. Or if Plenti would include a bundler.

Thank you

@jimafisk
Copy link
Member

Hi @Fankhauser-Dominik, this is a totally reasonable request, unfortunately Plenti is not great at working with other packages at the moment. At the core we try to take the unbundled approach like Snowpack, but it currently only works with ESM ready packages that are simple JS (it doesn't know how to go into npm and compile a svelte file there).

Long-term it would be nice if we made Plenti work better with other packages, most likely with the help of esbuild, which we could use natively (just not sure how the svelte compiling step would work).

Short-term, here are a couple of potential solutions:

  1. Could you include a dist folder in your package with precompiled components?
  2. You could manually copy over your lib folder into a Plenti project and use it directly

Those probably aren't ideal suggestions, but let me know if you want to explore either of them. Thanks!

@Fankhauser-Dominik
Copy link
Author

Hi @jimafisk
Thanks for your reply.
I already tried your second solution, but unfortunately, it didn't work for me.
I will try to compile my Components. I will let you know if it works.

@jimafisk
Copy link
Member

jimafisk commented Sep 26, 2022

Yeah I'm having trouble getting it working as well. A couple of problems are holding this back:

  1. Plenti doesn't have typescript support (Typescript support #47)
  2. Plenti can't import CSS files, is your bundler normally handling this (Import CSS file inside .svelte component sveltejs/svelte#3499 (comment))?
  3. I'm getting another error: SyntaxError: Unexpected token '-'

Plenti doesn't always play nicely with the JS toolchain unfortunately, hopefully we can make this better over time. For now, if work can be done with existing tools outside of the Plenti build, that might be the best path forward. Thanks for flagging this and testing your module @Fankhauser-Dominik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants