# postcss-ignore-plugin

> ignore postcss process for a rule using postcss-ignore comment

Latest version **0.2.1** (published 2020-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-ignore-plugin
pnpm add postcss-ignore-plugin
yarn add postcss-ignore-plugin
bun add postcss-ignore-plugin
```

## 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.1 |
| Published | 2020-05-24 |
| First published | 2020-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | anikethsaha |
| Maintainers | anixsaha |
| Keywords | postcss-plugin, ignore, postcss |

## Links

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

## Dependencies (1)

- [postcss](https://npm.io/package/postcss.md) ^7.0.16

## Recent versions

- 0.2.1 (latest) — 2020-05-24
- 0.2.0 — 2020-03-18
- 0.1.0 — 2020-02-19

## README

# postcss-ignore-plugin

![CI tests](https://github.com/anikethsaha/postcss-ignore-plugin/workflows/CI%20tests/badge.svg?branch=master&event=push)
![CI Integration tests](https://github.com/anikethsaha/postcss-ignore-plugin/workflows/CI%20Integration%20tests/badge.svg?branch=master&event=push)

Ignore postcss plugins operations in lines using comments

## Getting started

`$ yarn add postcss-ignore-plugin -D`

and add this it in your `postcss` config

```js
// postcss.config.js
module.exports = {
  plugins: [
    require('postcss-ignore-plugin/remove'), // Important to keep this at the top of the plugins
    require('cssnano'),
    require('autoprefixer'),
    require('stylelint'),
    require('postcss-ignore-plugin/add'), // Important to keep it at the end
  ],
};
```

Now use the following comments whenever you want to ignore any operation for other plugins

- for ignoring a particular line or declaration (css properties) inside of css rule

  ```css
  /* postcss-ignore-line */
  ```

  > Dont use `/* postcss-ignore-line */` for css rules

- for ignoring a whole rule

  ```css
  /* postcss-ignore */
  ```

## How it works

Currently we support only for declaration statement, that mean you can add this comment over CSS declaration line not over the selector list in Rule declaration

`example`

```css
.classname {
  margin: auto;
  /* postcss-ignore-line */
  color: red;
}

/* postcss-ignore */
.classname {
  margin: auto;
  color: red;
}

@media screen and (min-width: 480px) {
  ul {
    /* postcss-ignore-line */
    list-style: none;
  }

  /* postcss-ignore */
  p {
    font-size: 10px;
  }
}
```

It simple remove the next line before running the other plugins and then add them at the end.

## Rules

Use [`stylelint-postcss-ignore`](https://github.com/anikethsaha/stylelint-postcss-ignore) for rules regarding this plugin 's better use

## Tests

this plugins are tested with

- cssnano
- Autoprefixer
- postcss-preset-env
- stylelint
- some custom plugins meant to fail the op
- Indivial tests for each plugins

> There are not many test cases. More will be added soon

## FAQ

- **Can we ignore a whole css `atrules` (like media queries) ?**

  No, you need to use `/* postcss-ignore */` before each rule inside the `atrules`

- **will those ignore rules/properties (declarations) will come back to there original position after all operations?**

  No, both. rules and atrules will append at the end. declarations (rules's properties) will append at the rule itself. and if you have used `/* postcss-ignore */` for a rule inside of atrules, it will get appended for that atrule at the end

- **Does it effect the performance like the build time?**

  Yes _(sometimes for code with many ignore comments )_, but not at a huge level. It slightly decreases the performance as there are 2-3 nested looks so you can notices some issue with huge code with many ignore comments

## Contributing Guidelines

Simply click on this

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/anikethsaha/postcss-ignore-plugin)

and starting working in it !

**OR**

- clone the repo
- Install the dependenices `yarn install`
- Build the code `yarn build`
- run the tests before working `yarn test:only` and `yarn test:integrations`
- start working

If you add a new feature or did some breaking change , update [`stylelint-postcss-ignore`](https://github.com/anikethsaha/stylelint-postcss-ignore) for consistency

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