# @stylable/node

> Integrate Stylable into your node application

Latest version **6.1.1** (published 2024-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stylable/node
pnpm add @stylable/node
yarn add @stylable/node
bun add @stylable/node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.1.1 |
| Published | 2024-05-30 |
| First published | 2018-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.12.0 |
| Dependencies | 5 |
| Unpacked size | 35 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1273 |
| Author | Wix.com |
| Maintainers | tomrav, avi.vahl, idoros, baraki, cijoe, alexswix |

## Links

- npm: https://www.npmjs.com/package/@stylable/node
- Repository: https://github.com/wix/stylable.git#master
- Homepage: https://github.com/wix/stylable/tree/master#readme
- Issues: https://github.com/wix/stylable/issues
- npm.io page: https://npm.io/package/@stylable/node

## Dependencies (5)

- [find-config](https://npm.io/package/find-config.md) ^1.0.0
- [@stylable/core](https://npm.io/package/@stylable/core.md) ^6.1.1
- [@file-services/node](https://npm.io/package/@file-services/node.md) ^9.3.0
- [@stylable/build-tools](https://npm.io/package/@stylable/build-tools.md) ^6.1.1
- [@stylable/module-utils](https://npm.io/package/@stylable/module-utils.md) ^6.1.1

## Recent versions

- 6.1.1 (latest) — 2024-05-30
- 5.19.0 (release-5.x) — 2024-03-05
- 6.0.0-rc.3 (next) — 2024-02-01
- 4.15.1 (release-4.x) — 2022-08-14
- 3.13.2 (release-3.x) — 2021-12-09
- 1.4.0 (release-1.x) — 2020-03-05
- 6.1.0 — 2024-05-21
- 6.0.2 — 2024-04-15
- 6.0.1 — 2024-03-19
- 6.0.0 — 2024-03-13
- 5.18.1 — 2024-02-12
- 5.18.0 — 2024-01-14
- 5.17.0 — 2023-12-03
- 6.0.0-rc.2 — 2023-11-08
- 6.0.0-rc.1 — 2023-11-08
- … 211 more at https://npm.io/package/@stylable/node/versions

## README

# @stylable/node

[![npm version](https://img.shields.io/npm/v/@stylable/node.svg)](https://www.npmjs.com/package/@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

```sh
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](./src/require-hook.ts#L6).

```ts
const {attachHook} = require('@stylable/node');
attachHook();

const { style, classes } = require('./stylesheet.st.css');
```

## attachHook Options

```ts 
interface Options {
    /* override .st.css file match */
    matcher?: (filename: string) => boolean;
    /* stylable instance configure */
    stylableConfig?: Partial<StylableConfig>;
    /* 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;
}
```


## License
Copyright (c) 2017 Wix.com Ltd. All Rights Reserved. Use of this source code is governed by a [MIT license](./LICENSE).

---
_Source: https://npm.io/package/@stylable/node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
