# rework-import

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

Latest version **2.1.0** (published 2015-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install rework-import
pnpm add rework-import
yarn add rework-import
bun add rework-import
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2015-07-14 |
| First published | 2013-08-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 23 |
| Maintainers | jxson, moox, kevva |
| Keywords | css, import, media, rework |

## Links

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

## Dependencies (4)

- [css](https://npm.io/package/css.md) ^2.0.0
- [globby](https://npm.io/package/globby.md) ^2.0.0
- [url-regex](https://npm.io/package/url-regex.md) ^3.0.0
- [parse-import](https://npm.io/package/parse-import.md) ^2.0.0

## 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

- 2.1.0 (latest) — 2015-07-14
- 2.0.1 — 2015-01-28
- 2.0.0 — 2014-11-27
- 1.2.1 — 2014-09-05
- 1.2.0 — 2014-07-04
- 1.1.3 — 2014-06-27
- 1.1.2 — 2014-06-26
- 1.1.1 — 2014-06-26
- 1.1.0 — 2014-06-25
- 1.0.0 — 2014-06-14
- 0.0.3 — 2013-08-06
- 0.0.2 — 2013-08-06
- 0.0.1 — 2013-08-06

## README

# rework-import [![Build Status](http://img.shields.io/travis/reworkcss/rework-import.svg?style=flat)](https://travis-ci.org/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/rework-import · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
