nikokozak

nikokozak

Hello all,

I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed successor to Sveltex given that it’s been more than two years since any updates have been rolled out (Phoenix 1.6 is not supported), and because I couldn’t find any other libraries for integrating Svelte components with Phoenix views in a pleasant manner.

So far it’s been a real pleasure to use, with minimal (if any) pain points. It even includes a mix task that runs most of the tedious setup.

This is my first real attempt at a library, and I would love any help from others interested in Svelte + Phoenix integrations. I’ve been building it as I work on another project, and have been pretty lax regarding testing given that I’m not sure how to even go about testing a lib for Phoenix.

Other than that, I hope people find it useful - so far I’ve loved the productivity boost of being able to quickly integrate Svelte whenever more interactivity is called for, while still being able to use Phoenix views for most of my static content.

Have a lovely day!

Showing Posts 1 to 10

cpgo

cpgo

I’m not really familiar with the svelte ecosystem so forgive me if its a dumb question, but why not use the esbuild svelte plugin (esbuild - Plugins) instead of replacing esbuild?

nikokozak

nikokozak OP

Not at all! This is actually the next step I’m hoping to take, it’s just that I’m way more familiar with Rollup than I am with ESBuild, so I went with the former for my current project.

cpgo

cpgo

Oh I see. That makes sense :smiley:

egze

egze

That’s a cool library. I wonder if there’s also something similar for VueJS.

nikokozak

nikokozak OP

@cpgo Just updated the lib to use ESBuild - thank you for the suggestion, recompilation is much snappier!

cpgo

cpgo

Whoa that was fast!
I may use this as an excuse to start learning svelte again.
It looks like your readme link still points to rollup
https://github.com/nikokozak/svonix/commit/7d6648ac1986e0cad4d18afc7f5aedc01f2ec8a4#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L7

Eiji

Eiji

@nikokozak I really like that Svelte minifies transfer by fetching only required code. I was interested in this topic for a longer time. However I do not understand one thing …

We have LiveView which gives us a low resources usage at client side and I see that in theory we can go fully into Svelte SPA to have the reverse case. However what’s the sense of using any JavaScript only partially?

Do you think it’s reasonable to have only API over Phoenix channels and then use Svelte for the SPA to minify server resources usage or maybe this approach is too extreme?

Do you plan to support or if there is nothing extra needed just write documentation how to setup Svelte SPA using your library?

LostKobrakai

LostKobrakai

I like the thought of a svelte SPA (possibly with node or deno on the server-side), but having a phoenix API as well as a svelte store implementation, which uses channels to sync data with the SPA similar to liveview, but as you said, kinda in reverse.

TwistingTwists

TwistingTwists

I am sorry if this is dumb, but

Can you give a real world scenario for this reverse Svelte implementation? Like where this sort of thing would be “necessary”?

Eiji

Eiji

“There is no such thing as a dumb question”

Carl Sagan, The Demon-Haunted World: Science as a Candle in the Dark

:wink:

How about you want to render huge amount of data? I believe that in such case you may decide to stream data using Phoenix channel and render one entry or graph at a time, so the first (ordered or just most important) things would appear immediately. In some cases deliver content as soon as possible may be critical. Even on typical forums you have either pagination or render when needed strategies i.e. you never have rendering list of all topics.

Where Next? Top

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
woylie
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto. pagination cursor pagination sorta...
New
kip
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New

Other Trending Topics Top

akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews