Continuing the discussion from Why do we have plonecli and bobtemplates.plone?:
Anyone else doing Svelte on Plone? Svelte is super simple to think about and @MrTango has extended PloneCLI so that you can generate Svelte boilerplate for Plone.
Continuing the discussion from Why do we have plonecli and bobtemplates.plone?:
Anyone else doing Svelte on Plone? Svelte is super simple to think about and @MrTango has extended PloneCLI so that you can generate Svelte boilerplate for Plone.
I wrote an addon for @agitator with a some minimal JS (so I could have done it with plain Javascript as well) here https://github.com/collective/collective.bookmarks
I did not use the bobtemplate (b/c it was before it exists).
I used a pattern to initialize the Svelte components. I am not sure if it is good practice, but it works.
I like.
It's not a solution to everything and by any means a replacement for Volto, but a nice way to enhance classic Plone with modern Javascript components.
PS. you might want to use the new plonecli==2.0b1
Yup! It's certainly a great "stop gap" for projects where Volto is not practical at the moment.
Did not know about before now
Is 'this still relevant' (for Classic of course).
Lets say one has a view template.pt with two buttons ( Books and Magazines )
The (current) template shows books ('view/get_books') and magazines (view/get_magazines) and toggles books/magazines depending on which button is clicked.
Lets say you want to 'just have one 'view/get_content maybe' and if you click on 'books', view_getcontent gets all the books, but if you click on 'magazines', it gets all magazines.
Is this a 'typical use case for Svelte'? If so, I might give it a try.
Not sure what you try to achieve, but when you want to load parts of a page asynchronously check out pat-inject
from patternslib Inject — Patterns . This is shipped with Plone 6.0 and can be used OOTB.
A few years later we've finished @MrTango 's pat-contentbrowser
pattern which is a svelte app for Plone 6.1 and replaces the relateditems
select2 implementation. Check out the PR here: `pat-contentbrowser` implementation by petschki · Pull Request #1377 · plone/mockup · GitHub
You get this with the latest version pins from https://raw.githubusercontent.com/plone/buildout.coredev/refs/heads/6.1/versions.cfg
You can use it for any simple use case, much like jQuery back in the days. But with more modern features. If you just want the tow buttons, pat-inject is probably enough though. For anything else you want build in a modern way, svelte is a good choice. I'll try to update the bob template to use Svelte 5 as soon as i can. But all your code will keep working even in v5.
Thanks. That works