PostCSS
Installation
-
Install
stilvolland@stilvoll/postcssTerminal window npm install -D stilvoll @stilvoll/postcss -
Include the plugin in your postcss config
postcss.config.js module.exports = {plugins: { "@stilvoll/postcss": {} },}; -
Create a
stilvoll.config.jsfile:stilvoll.config.js export default {input: ["./src/index.css"],rules: [// Define or use imported rules here],}; -
Add the
@stilvolldirective to your main CSS file. This will get replaced by the generated utility class in the build step.main.css @stilvoll; -
You can now use your utility classes directly, or by importing the
svobjectpage.jsx import React from 'react';import cn from 'classnames';import { sv } from 'stilvoll';function Page() {return (<div className={cn(sv.flex, sv.items_center, sv.gap_l)}><div className={sv.invisible}>OMG, typesafe utility classes, so nice.</div></div>);}export default Page;