@wroud/vite-plugin-ssg
Version:
A Vite plugin for static site generation (SSG) with React. Renders React applications to static HTML for faster load times and improved SEO.
26 lines • 776 B
JavaScript
import parseStyles from "style-to-object";
import * as changeCase from "change-case";
export function mapHtmlAttributeToReactProps(attributes) {
if (!attributes) {
return attributes;
}
const props = {};
for (const key in attributes) {
const value = attributes[key];
switch (key) {
case "class":
props["className"] = value;
break;
case "for":
props["htmlFor"] = value;
break;
case "style":
props["style"] = parseStyles(value);
break;
default:
props[changeCase.camelCase(key)] = value;
}
}
return props;
}
//# sourceMappingURL=mapHtmlAttributeToReactProps.js.map