radish
Version:
Radish is a React-based static site generator that outputs plain HTML and CSS.
13 lines (12 loc) • 423 B
JavaScript
import * as fs from "node:fs";
import { transform } from "@svgr/core";
export const svgPlugin = {
name: "svg",
setup(build) {
build.onLoad({ filter: /\.react\.svg$/ }, async (args) => {
const svg = await fs.promises.readFile(args.path, "utf-8");
const contents = await transform(svg, {}, { filePath: args.path });
return { contents, loader: "jsx" };
});
}
};