Use with Vite
First, install the loader:
npm install --save-dev @macaron-elements/loader-vite
Configure vite.config.js
:
import { defineConfig } from "vite";
import macaronLoader from "@macaron-elements/loader-vite";
export default defineConfig({
plugins: [macaronLoader()],
});
Import the .macaron
file directly from HTML:
<script type="module">
import "./components.macaron";
</script>
<my-component></my-component>
or from JS:
import "./components.macaron";
const element = document.createElement("my-component");