npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

postcss-ignore-plugin

v0.2.1

Published

ignore postcss process for a rule using postcss-ignore comment

Downloads

279

Readme

postcss-ignore-plugin

CI tests CI Integration tests

Ignore postcss plugins operations in lines using comments

Getting started

$ yarn add postcss-ignore-plugin -D

and add this it in your postcss config

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

    /* postcss-ignore-line */

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

  • for ignoring a whole rule

    /* 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

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

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 for consistency