@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.
Installation
yarn add --dev @stylable/node
Usage
Import the attachHook
utility from @stylable/node
, and invoke it.
The attachHook
can receive optional arguments in the form of a config
object.
See the type definition here.
const {attachHook} = require('@stylable/node');
attachHook();
const { style, classes } = require('./stylesheet.st.css');
attachHook Options
interface Options {
matcher?: (filename: string) => boolean;
stylableConfig?: Partial<StylableConfig>;
afterCompile?: (code: string, filename: string) => string;
runtimePath?: string;
ignoreJSModules?: boolean;
}
License
Copyright (c) 2017 Wix.com Ltd. All Rights Reserved. Use of this source code is governed by a MIT license.