Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomasz-sodzawiczny/postcss-plugin-chain
Utility for chaining multiple PostCSS plugins as a single one.
https://github.com/tomasz-sodzawiczny/postcss-plugin-chain
chain chaining plugin postcss postcss-plugin
Last synced: about 2 hours ago
JSON representation
Utility for chaining multiple PostCSS plugins as a single one.
- Host: GitHub
- URL: https://github.com/tomasz-sodzawiczny/postcss-plugin-chain
- Owner: tomasz-sodzawiczny
- License: mit
- Created: 2019-02-24T18:12:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-24T21:24:50.000Z (almost 6 years ago)
- Last Synced: 2025-01-19T00:52:08.573Z (3 days ago)
- Topics: chain, chaining, plugin, postcss, postcss-plugin
- Language: JavaScript
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# postcss-plugin-chain [][postcss]
[![License: MIT][mit-img]][mit-url]
[![NPM version][npm-img]][npm-url]
[![Build Status][build-img]][build-url]Utility for chaining multiple [PostCSS] plugins as a single one.
```js
// Define the plugin:
import chainPlugins from 'postcss-plugin-chain';const shapesPlugin = chainPlugins('postcss-shapes', [
require('postcss-circle'),
require('postcss-triangle'),
]);// And use it:
postcss([shapesPlugin]);
```## Installation
```sh
yarn add --dev postcss-plugin-chain
```## Usage
`chainPlugins()` function accepts 2 parameters: `pluginName` and `pluginsToChain` - both pretty self-explanatory.
Returned value is an asynchronous [postcss plugin].
## Options
If the plugin created with `chainPlugins` is initialized with options it passes them down to all chained plugins.
If you need to control the options passed to some specific plugins (e.g. map options names or set some defaults), you can wrap the plugin in a function:
```js
const chainedPlugin = chainPlugins('options-example', [
options => require('postcss-calc')({ ...options, selectors: true }),
// ...
]);
```## License
[MIT](./LICENSE)
[mit-img]: https://img.shields.io/badge/License-MIT-blue.svg
[mit-url]: https://opensource.org/licenses/MIT
[npm-img]: https://img.shields.io/npm/v/postcss-plugin-chain.svg
[npm-url]: https://www.npmjs.com/package/postcss-plugin-chain
[build-img]: https://img.shields.io/travis/tomasz-sodzawiczny/postcss-plugin-chain.svg
[build-url]: https://travis-ci.org/tomasz-sodzawiczny/postcss-plugin-chain[postcss]: https://postcss.org/
[postcss plugin]: http://api.postcss.org/postcss.html#.plugin