# postcss-docs

> PostCSS doc comments

Latest version **0.1.0** (published 2021-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-docs
pnpm add postcss-docs
yarn add postcss-docs
bun add postcss-docs
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2021-01-13 |
| First published | 2021-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jan Unnold |
| Maintainers | janunld |

## Links

- npm: https://www.npmjs.com/package/postcss-docs
- npm.io page: https://npm.io/package/postcss-docs

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) ^8.2.4
- [comment-parser](https://npm.io/package/comment-parser.md) ^1.0.1

## Recent versions

- 0.1.0 (latest) — 2021-01-13

## README

# PostCSS Docs

[PostCSS](https://github.com/postcss/postcss) plugin for doc comments.

```css
/**
 * More complex doc
 *
 * @var {Color} --foo-color The value used as "color"
 */
.foo {
  color: var(--foo-color, currentColor);
}
```

After processing the above `css` source the result AST will contain additional information
extracted from the parsed comments. **Parsing is not part of the implementation of this
package!** Parsing is done using [`comment-parser`](https://github.com/syavorsky/comment-parser).
Both, the targeted `Rule` node as well as the `Comment` node will contain a `doc` field after
the processing is done.

```json
{
  "description": "More complex doc",
  "text": "/** ... */",
  // postcss ChildNode, can be null
  "target": { ... },
  "tags": [
    {
      "tag": "var",
      "description": "The value used as \"color\"",
      "name": "--foo-color",
      "type": "Color",
      "optional": false
      ...
    }
  ],
  // from comment-parser
  "source": [ ... ],
  // from comment-parser
  "problems": [ ... ]
}
```

##### Useful Links

- [`comment-parser` Result API](https://github.com/syavorsky/comment-parser#result)
- [`postcss` API](https://postcss.org/api)

## Usage

**Step 1:** Install plugin:

```sh
npm install --save-dev postcss postcss-docs
```

**Step 2:** Check you project for existed PostCSS config: `postcss.config.js` in the project
root, `"postcss"` section in `package.json` or `postcss` in bundle config.

If you do not use PostCSS, add it according to the [official docs](https://github.com/postcss/postcss#usage).

**Step 3:** Add the plugin to your config

```diff
module.exports = {
  plugins: [
+   require('postcss-docs')
  ]
}
```

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