Integrate Stylable into your node application
npm install @stylable/node
@stylable/node is a simple integration that allows integrating Stylable into your node application. The most common use-case is server-side rendering.
``sh`
yarn add --dev @stylable/nodeattachHookUsage
Import the utility from @stylable/node, and invoke it.attachHook
The can receive optional arguments in the form of a config object.
See the type definition here.
`ts
const {attachHook} = require('@stylable/node');
attachHook();
const { style, classes } = require('./stylesheet.st.css');
`
`ts ``
interface Options {
/ override .st.css file match /
matcher?: (filename: string) => boolean;
/ stylable instance configure /
stylableConfig?: Partial
/ hook for after compile /
afterCompile?: (code: string, filename: string) => string;
/ request for the @stylable/runtime /
runtimePath?: string;
/ should ignore built .st.css.js files /
ignoreJSModules?: boolean;
}