0.1.0 • Published 1 year ago

svelte-vars v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Eyeballs tripping up over a couple of dollar signs? Do you exclusively use const and let in your code? Have a play with this.

To get started, here's an example of what your svelte.config.js file might look like when using this plugin in a SvelteKit project:

import { svelteVars } from 'svelte-vars'
export default {
	preprocess: [ svelteVars(), vitePreprocess() ],
	kit: { adapter: adapter() }
}

And within your Svelte components, you can now do the following:

<script lang="ts">
    let value = 0;
    // $: doubled = value * 2;
    var doubled = value * 2;
    const increment = () => val = val + 1
</script>

<button on:click={increment}>{doubled}</button>
0.1.0

1 year ago