# postcss-editor-styles

> Remove your editor-styles from the global scope

Latest version **0.5.0** (published 2024-03-07) · GPL-2.0+ license · 0 weekly downloads

## Install

```sh
npm install postcss-editor-styles
pnpm add postcss-editor-styles
yarn add postcss-editor-styles
bun add postcss-editor-styles
```

## 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.5.0 |
| Published | 2024-03-07 |
| First published | 2018-11-29 |
| Weekly downloads | 0 |
| License | GPL-2.0+ |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^16 \|\| >=18 |
| Dependencies | 0 |
| Unpacked size | 36.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | m-e-h |
| Maintainers | m-e-h |
| Keywords | postcss, css, postcss-plugin, wordpress, gutenberg |

## Links

- npm: https://www.npmjs.com/package/postcss-editor-styles
- Repository: https://github.com/m-e-h/postcss-editor-styles
- Homepage: https://github.com/m-e-h/postcss-editor-styles#readme
- Issues: https://github.com/m-e-h/postcss-editor-styles/issues
- npm.io page: https://npm.io/package/postcss-editor-styles

## Recent versions

- 0.5.0 (latest) — 2024-03-07
- 0.4.0 — 2024-03-07
- 0.3.0 — 2019-10-07
- 0.1.5 — 2019-06-25
- 0.1.4 — 2019-01-24
- 0.1.2 — 2018-12-01
- 0.1.0 — 2018-11-29

## README

# PostCSS Editor Styles [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]

[![NPM Version][npm-img]][npm-url]

PostCSS Editor Styles lets you do this in CSS.

```css
:root {           /* ignored */
  --color-text: #24292e;
}

html {            /* removed */
  font-family: sans-serif;
}

body {            /* replaced */
  color: var(--color-text);
}

button {          /* scoped and negated */
  min-height: 1.5rem;
}

.block-heading {  /* scoped */
  background-color: #eee;
}

/* becomes */

:root {
  --color-text: #24292e;
}

.editor-styles-wrapper {
  color: var(--color-text);
}

.editor-styles-wrapper button:not([class^="components-"]):not([class^="editor-"]):not([class^="block-"]):not([aria-owns]) {
  min-height: 1.5rem;
}

.editor-styles-wrapper .block-heading {
  background-color: #eee;
}
```

## Usage

Add PostCSS Editor Styles to your project:

```bash
npm install postcss-editor-styles --save-dev
```

Use PostCSS Editor Styles to process your CSS:

```js
const postcssEditorStyles = require("postcss-editor-styles");

postcssEditorStyles.process(YOUR_CSS /*, processOptions, pluginOptions */);
```

Or use it as a [PostCSS] plugin:

```js
const postcss = require("postcss");
const postcssEditorStyles = require("postcss-editor-styles");

postcss([postcssEditorStyles(/* pluginOptions */)]).process(
  YOUR_CSS /*, processOptions */
);
```

## Options
defaults:
```js
// The selector we're working within.
scopeTo: '.editor-styles-wrapper',

// Increase specificity by repeating the selector.
repeat: 1,

remove: ['html'],

replace: ['body'],

ignore: [':root'],

tags: ['a', 'button', 'input', 'label', 'select', 'textarea', 'form'],

tagSuffix: ':not([class^="components-"]):not([class^="editor-"]):not([class^="block-"]):not([aria-owns])'
```


PostCSS Editor Styles runs in all Node environments, with special instructions for:

| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| ----------------------- | ------------------------------------- | ----------------------------- | ----------------------------------------------- | ----------------------- | ------------------------- |


[npm-img]: https://img.shields.io/npm/v/postcss-editor-styles.svg
[npm-url]: https://www.npmjs.com/package/postcss-editor-styles
[postcss]: https://github.com/postcss/postcss

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