# postcss-atroot

> PostCSS plugin to place rules directly at the root

Latest version **0.2.4** (published 2023-10-06) · MIT license · 0 weekly downloads

## Install

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

## 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.2.4 |
| Published | 2023-10-06 |
| First published | 2015-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | OEvgeny |
| Maintainers | oevgeny |
| Keywords | postcss, at-root, postcss-plugin, sass, atroot, css |

## Links

- npm: https://www.npmjs.com/package/postcss-atroot
- Repository: https://github.com/OEvgeny/postcss-atroot
- Homepage: https://github.com/OEvgeny/postcss-atroot#readme
- Issues: https://github.com/OEvgeny/postcss-atroot/issues
- npm.io page: https://npm.io/package/postcss-atroot

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

- 0.2.4 (latest) — 2023-10-06
- 0.2.3 — 2021-05-24
- 0.1.3 — 2015-11-21
- 0.1.2 — 2015-09-20
- 0.1.0 — 2015-09-20

## README

# PostCSS at-root [![Circle CI](https://circleci.com/gh/OEvgeny/postcss-atroot.svg?style=svg)](https://circleci.com/gh/OEvgeny/postcss-atroot)
PostCSS plugin to place rules directly at the root node.

The ``@at-root`` causes one or more rules to be emitted at the root of the document, rather than being nested beneath their parent selectors:
```css
.parent {
  ...
  @at-root{
    .child {...}
  }
}
```
Which would produce:
```css
.child { ... }
.parent { ... }
```

It will play well with postcss ``@include`` plugins.  
foo.css:
```css
@at-root {
  @viewport { width: device-width; }
}
.foo {
  color: blue;
}
```

bar.css:
```css
.bar {
  @import "foo.css";
}

```
Will produce:
```css
@viewport { width: device-width; }

.bar .foo {
  color: blue; 
}
```

## Usage

```js
postcss([ require('postcss-atroot')() ])
```

See [PostCSS] docs for examples for your environment.

[PostCSS]: https://github.com/postcss/postcss

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