Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-filter-plugins

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-filter-plugins

Exclude/warn on duplicated PostCSS plugins.

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
607K
increased by1.08%
Maintainers
2
Weekly downloads
 
Created

What is postcss-filter-plugins?

The postcss-filter-plugins package is a PostCSS plugin that allows you to filter out other PostCSS plugins based on certain criteria. This can be useful for avoiding duplicate plugins, ensuring specific plugins are only applied once, or conditionally applying plugins based on certain conditions.

What are postcss-filter-plugins's main functionalities?

Filter out duplicate plugins

This feature allows you to filter out duplicate plugins from your PostCSS plugin list. In the example, the 'autoprefixer' plugin is included twice, but the filterPlugins function will exclude the duplicate.

const postcss = require('postcss');
const filterPlugins = require('postcss-filter-plugins');

const plugins = [
  require('autoprefixer'),
  require('autoprefixer'), // duplicate
  filterPlugins({
    exclude: ['autoprefixer']
  })
];

postcss(plugins).process(css).then(result => {
  console.log(result.css);
});

Conditionally apply plugins

This feature allows you to conditionally apply plugins based on custom logic. In the example, the 'autoprefixer' plugin is excluded if the NODE_ENV environment variable is set to 'production'.

const postcss = require('postcss');
const filterPlugins = require('postcss-filter-plugins');

const plugins = [
  require('autoprefixer'),
  filterPlugins({
    exclude: plugin => plugin.postcssPlugin === 'autoprefixer' && process.env.NODE_ENV === 'production'
  })
];

postcss(plugins).process(css).then(result => {
  console.log(result.css);
});

Other packages similar to postcss-filter-plugins

Keywords

FAQs

Package last updated on 18 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc