Summary: To use Svelte instead of jQuery in existing Flask apps.
Problem: We've got an existing Flask/Jinja2 server-side rendered website. It uses jQuery. I'd like to use Svelte without SPA/Sapper/Router/etc. and just as a library. Ofcourse, Svelte is a compiled preprocessor that generates optimized vanilla JS that manages state/reactivity without shadow DOM or any other tricks that React/Angular uses.
Requirements: Multipage app, cannot be SPA. Routing is not needed, we're fine with page refresh :) and no state needs to be shared between pages (except for cookies ofcourse).
Impact: Svelte is great, but vast majority of enterprise and silent majority already have websites written in Flask/Django with some JS functionality (most likely jQuery). Wouldn't be great to use a preprocessor such as Svelte to add interactivity/reactivity to existing websites? Not everyone has the luxury to build SPA apps and there are other reasons for not building one (SEO for e.g.).
Possible Ideas:
- Webpack: Preprocess Svelte app to .js file + .html file. Serve both after rendering it through Jinja2 templating engine.
How Vue.js does this: How to render by Vue instead of Jinja
Thoughts? I am not familiar with Webpack enough but Svelte seems to be a perfect fit for taking Javascript interactivity/reactivity and precompiling it to be served in Flask/Jinja2 or Django apps. Benefits are amazing: get rid of jQuery, add component architecture, fast, vanilla JS, and small!