# @fomantic/rework-import

> A rework plugin to read and inline CSS files via @import

Latest version **4.3.0** (published 2026-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fomantic/rework-import
pnpm add @fomantic/rework-import
yarn add @fomantic/rework-import
bun add @fomantic/rework-import
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2026-07-18 |
| First published | 2022-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18.18.0 |
| Dependencies | 4 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | hammy2899, fomantic-bot, lubber |
| Keywords | css, import, media, rework |

## Links

- npm: https://www.npmjs.com/package/@fomantic/rework-import
- Repository: https://github.com/fomantic/rework-import
- Homepage: https://github.com/fomantic/rework-import#readme
- Issues: https://github.com/fomantic/rework-import/issues
- npm.io page: https://npm.io/package/@fomantic/rework-import

## Dependencies (4)

- [unixify](https://npm.io/package/unixify.md) ^1.0.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3
- [parse-import](https://npm.io/package/parse-import.md) ^2.0.0
- [@adobe/css-tools](https://npm.io/package/@adobe/css-tools.md) ^4.4.2

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 4.3.0 (latest) — 2026-07-18
- 4.2.0 — 2026-07-17
- 4.1.0 — 2025-03-01
- 4.0.0 — 2025-03-01
- 3.2.0 — 2025-02-08
- 3.1.0 — 2024-05-07
- 3.0.0 — 2022-10-28
- 2.1.1 — 2022-10-28

## README

# rework-import [![Build Status](http://img.shields.io/travis/reworkcss/rework-import.svg?style=flat)](https://travis-ci.org/reworkcss/rework-import)

> ### Forked Version using updated dependencies and dropped sourceMap support
> Original repo at https://github.com/reworkcss/rework-import

> Import stylesheets using `@import` and an optional media query


## Install

```bash
$ npm install --save rework-import
```


## Usage

```js
var data = require('fs').readFileSync('index.css');
var imprt = require('rework-import');
var rework = require('rework');

rework(data)
	.use(imprt({path: 'app/stylesheets'}))
	.toString();
```


## Options

### encoding

Type: `String`  
Default: `utf8`

Use if your CSS is encoded in anything other than `UTF-8`.

### path

Type: `Array|String`  
Default: `process.cwd()` or `__dirname` of [the rework source](https://github.com/reworkcss/css#cssparsecode-options)

A string or an array of paths in where to look for files.

_Note: nested `@import` will additionally benefit of the relative dirname of imported files._

### transform

Type: `Function`  

A function to transform the content of imported files. Takes one argument and should return the modified content. Useful if you use [`css-whitespace`](https://github.com/reworkcss/css-whitespace).


## Example

```css
@import 'foo.css' (min-width: 25em);

body {
	background: black;
}
```

yields:

```css
@media (min-width: 25em) {
	body {
		background: red;
	}

	h1 {
		color: grey;
	}
}

body {
	background: black;
}
```


## License

MIT © [Jason Campbell](https://github.com/jxson) and [Kevin Mårtensson](http://github.com/kevva)

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