Treat html inputs as WebC.
- Install
npm install --save-dev https://github.com/malobre/vite-plugin-webc.git
- Add plugin to your vite config
import { defineConfig } from 'vite' import webc from '@malobre/vite-plugin-webc' export default defineConfig({ plugins: [webc(/* config */)], })
type Config = {
// See https://github.com/11ty/webc/tree/v0.11.4?tab=readme-ov-file#register-global-components
components?: string | Array<string> | Array<{ [_: string]: string }>;
// See https://github.com/11ty/webc/tree/v0.11.4?tab=readme-ov-file#custom-transforms
transforms?: {
[type: string]: (content: string) => Promise<string> | string;
};
// See https://github.com/11ty/webc/tree/v0.11.4?tab=readme-ov-file#helper-functions
helpers?: {
[name: string]: () => unknown;
};
};
- Input files are processed has if they were located in the vite project root folder.