https://github.com/koffeine/rollup-plugin-postcss
Rollup plugin for PostCSS
https://github.com/koffeine/rollup-plugin-postcss
postcss rollup rollup-plugin
Last synced: 2 months ago
JSON representation
Rollup plugin for PostCSS
- Host: GitHub
- URL: https://github.com/koffeine/rollup-plugin-postcss
- Owner: koffeine
- License: mit
- Created: 2021-04-17T17:21:38.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T06:59:40.000Z (over 4 years ago)
- Last Synced: 2026-03-28T19:34:49.572Z (3 months ago)
- Topics: postcss, rollup, rollup-plugin
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
rollup-plugin-postcss
Rollup plugin for PostCSS
## What it does
- Transforms imported CSS files using PostCSS plugins
- Concatenates and extracts processed styles
## Features
- Sourcemap support
- Only generates and saves sourcemap when requested by the configuration
- Generates correct sourcemap file that traces back to the original imported file
- Makes sources relative to cwd by default, but this can be overridden with a custom sourcemapPathTransform function
## Installation
```sh
npm install @koffeine/rollup-plugin-postcss postcss --save-dev
```
## Usage
```js
import postcss from '@koffeine/rollup-plugin-postcss';
export default {
plugins: [
postcss({
// which files should be processed by this plugin
// type: regular expression, minimatch pattern or an array of regular expressions and minimatch patterns
include: /\.css/u,
// which files should not be processed by this plugin
// type: regular expression, minimatch pattern or an array of regular expressions and minimatch patterns
exclude: undefined,
// whether or not to generate and save a sourcemap
// type: boolean
sourcemap: false,
// transformation to apply to each source path in a sourcemap
// type: (source: string, id: string) => string
// source: sourcemap source
// id: module id (as reported by Rollup)
// returns: transformed path
sourcemapPathTransform: (source) => path.relative(process.cwd(), source),
// which PostCSS plugins to use
// type: array of PostCSS plugins
plugins: [],
// where to save the output file which is a Rollup asset relative to output.dir (required)
// type: string
output: undefined
})
]
};
```
## License
Copyright © Kornél Horváth
Licensed under the [MIT License](https://raw.githubusercontent.com/koffeine/rollup-plugin-postcss/master/LICENSE).