Gatsby plugin which wraps the vanilla-extract package for easy use
npm install gatsby-plugin-vanilla-extractGatsby plugin which wraps the vanilla-extract project for easy use in Gatsby.
``shell`
npm install gatsby-plugin-vanilla-extract @vanilla-extract/css @vanilla-extract/webpack-plugin
Add to your site's gatsby-config.js.
`jsgatsby-plugin-vanilla-extract
module.exports = {
plugins: [],`
};
You can also pass any vanilla-extract configuration object to the plugin.
`jsgatsby-plugin-vanilla-extract
module.exports = {
plugins: [
{
resolve: ,short
options: {
identifiers: ,`
},
},
],
};
See the vanilla-extract website for full documentation.
src/pages/index.tsx:
`tsx
import * as React from "react";
import { className } from "../styles/index.css.ts";
export default function Index() {
return
src/styles/index.css.ts:`ts
import { style } from "@vanilla-extract/css";export const className = style({
background: "red",
});
``Kick off your project using Gatsby's example project
- TypeScript & Gatsby
- vanilla-extract website
- Talk/Video Explanation