Civet icon indicating copy to clipboard operation
Civet copied to clipboard

Integrating Svelte?

Open levitabris opened this issue 2 years ago • 15 comments
trafficstars

Svelte is gaining popularity among people who appreciate simplicity and easy composability. Since its functionality is not based on a js import, would you consider making Civet compatible with .svelte components?

I would recommend a syntax like the following:

<script lang="civet"> 'hello world!' |> console.log </script>

levitabris avatar Feb 09 '23 14:02 levitabris

Sounds like a great idea! Perhaps we can mimic svelte-add/coffeescript? Or is svelte-add still active / the right approach?

Let us know if you'd like to work on this; it doesn't look too difficult.

edemaine avatar Feb 09 '23 16:02 edemaine

We'll need to add support for $: labels too. Should be straightforward.

STRd6 avatar Feb 09 '23 16:02 STRd6

Looking at Svelte's TypeScript support, the transpilation may be possible now with our existing Vite plugin which should also work as a Rollup plugin. But obviously this needs testing.

edemaine avatar Feb 09 '23 16:02 edemaine

Sounds like a great idea! Perhaps we can mimic svelte-add/coffeescript? Or is svelte-add still active / the right approach?

Let us know if you'd like to work on this; it doesn't look too difficult.

Not sure if it is the right approach. But I can experiment with mimicing the svelte-add coffeescript and see what happens.

levitabris avatar Feb 13 '23 02:02 levitabris

Great! Feel free to suggest a better approach as well if you find one.

FYI, we've added support for $: to Civet already.

edemaine avatar Feb 13 '23 04:02 edemaine

There is a bit learning curve here. My WIP version:

https://github.com/levitabris/svelte-add

levitabris avatar Feb 13 '23 06:02 levitabris

Update: It seems that svelte-add coffee script support is just a wrapper around svelte-proprocess(feel free to correct me if wrong), which implemets the original coffee support for svelte. I'm looking into how it was done in the svelte-preprocess.

BTW, the svelte-preprocess seems to be straight forward to config itself🦦

levitabris avatar Feb 13 '23 07:02 levitabris

@levitabris Have you taken a look at our new Rollup and Vite plugins? https://github.com/DanielXMoore/Civet/tree/main/integration/unplugin/examples please try them out and let us know if you have any questions or encounter any errors, thanks!

STRd6 avatar Sep 05 '23 03:09 STRd6