# postcss-icss-parser

> A PostCSS plugin for parsing import/export statements out of CSS that follows the ICSS specification, eg. for CSS Modules.

Latest version **1.0.0** (published 2021-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-icss-parser
pnpm add postcss-icss-parser
yarn add postcss-icss-parser
bun add postcss-icss-parser
```

## 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 | 1.0.0 |
| Published | 2021-02-17 |
| First published | 2021-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sven Slootweg |
| Maintainers | joepie91 |

## Links

- npm: https://www.npmjs.com/package/postcss-icss-parser
- Repository: https://git.cryto.net/joepie91/postcss-icss-parser
- npm.io page: https://npm.io/package/postcss-icss-parser

## Dependencies (6)

- [icss-utils](https://npm.io/package/icss-utils.md) ^5.1.0
- [loader-utils](https://npm.io/package/loader-utils.md) ^2.0.0
- [@validatem/core](https://npm.io/package/@validatem/core.md) ^0.3.15
- [@validatem/required](https://npm.io/package/@validatem/required.md) ^0.1.1
- [@validatem/is-boolean](https://npm.io/package/@validatem/is-boolean.md) ^0.1.1
- [@validatem/is-function](https://npm.io/package/@validatem/is-function.md) ^0.1.0

## Recent versions

- 1.0.0 (latest) — 2021-02-17

## README

# postcss-icss-parser

A PostCSS plugin for parsing import/export statements out of CSS that follows the ICSS specification, eg. for CSS Modules.

This code was adapted from [css-loader](https://github.com/webpack-contrib/css-loader) and modified to work as a stand-alone plugin.

This documentation is rudimentary and will probably be improved at some point. Feel free to open an issue if something is unclear!

## License

```
This module is derived from: css-loader (https://github.com/webpack-contrib/css-loader)
	(c) JS Foundation and other contributors

Modifications by:
	(c) 2019, Sven Slootweg <admin@cryto.net>

Licensed under:
	MIT (https://opensource.org/licenses/MIT)
```

## API

Exports a plugin that is compatible with PostCSS 8.

Takes the following options upon initialization:

- `keyReplacer`: A `function({ localKey, remoteKey, index, url })` that is expected to return the new, mangled name for a given imported identifier.
	- `url`: The path or URL that is being imported from.
	- `localKey`: The local name that it is imported under in the file.
	- `remoteKey`: The identifier name in the original file that is being imported *from*.
	- `index`: A number that increments for each processed import. Global across the entire AST pass.
- `autoExportImports`: *Optional.* When set to true, the local key of every imported identifier is also automatically considered to be re-exported from the file, even if no explicit export statement exists for it.

When applied, it will extract import/export statements from the code, exposing them as the following types of `messages` (from plugin `postcss-icss-parser`):

- `icss-import`: an import statement.
	- `url`, `localKey`, `remoteKey`, `index`: Same as for the `keyReplacer` option above.
	- `newKey`: The new key that was generated by the `keyReplacer`.
- `icss-export`: an export statement.
	- `name`: The key being exported.
	- `value`: The value that this key holds.

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