A Svelte Preprocessor to compile nim
$ npm install -D svelte-preprocess-nim
Example: svelte.config.js
// svelte.config.js
const sveltePreprocess = require("svelte-preprocess");
const { transformSync } = require("svelte-preprocess-nim");
module.exports = {
preprocess: sveltePreprocess({
nim({ content, filename, attributes }) {
const { code } = transformSync(content, {});
return { code };
},
}),
};
.svelte
files// App.svelte
<script src="./App.nim">
</script>
<div class="App" />
<style>
</style>
OR
// App.svelte
<script lang="nim">
import std/jsconsole
console.log("Hello, nim!")
</script>
<div class="App" />
<style>
</style>
NOTES: To use the editor's language support, you need to select the former.
MIT © NaokiM03