@greenwood/plugin-postcss v0.30.0
@greenwood/plugin-postcss
Overview
A Greenwood plugin for loading PostCSS configuration and applying it to your CSS.
This package assumes you already have
@greenwood/cli
installed.
Installation
You can use your favorite JavaScript package manager to install this package.
examples:
# npm
npm install @greenwood/plugin-postcss --save-dev
# yarn
yarn add @greenwood/plugin-postcss --dev
Usage
Add this plugin to your greenwood.config.js.
import { greenwoodPluginPostCss } from '@greenwood/plugin-postcss';
export default {
...
plugins: [
greenwoodPluginPostCss()
]
}
By default, this plugin provides a default postcss.config.js that includes support for postcss-preset-env using browserslist and postcss-import.
export default {
plugins: [
(await import('postcss-import')).default,
(await import('postcss-preset-env')).default
]
};
Note: Greenwood provides the postcss-import behavior out of the box.
Options
Configuration
To use your own PostCSS configuration, you'll need to create two (2) config files in the root of your project, by which you can provide your own custom plugins / settings that you've installed.
- postcss.config.js
- postcss.config.mjs
Example:
// postcss.config.js
module.exports = {
plugins: [
require('postcss-nested')
]
};
// postcss.config.mjs
export default {
plugins: [
(await import('postcss-nested')).default
]
};
Eventually once PostCSS adds support for ESM configuration files, then this will drop to only needing one file.
Extend Config
If you would like to extend the default configuration with your own custom postcss.config.js, you can enable the extendConfig
option of this plugin
import { greenwoodPluginPostcss } from '@greenwood/plugin-postcss';
export default {
// ...
plugins: [
greenwoodPluginPostcss({
extendConfig: true
})
]
};
This will then process your CSS with PostCSS using the configured plugins / settings you provide, merged after the default Greenwood configuration listed above.
9 months ago
8 months ago
9 months ago
1 year ago
1 year ago
10 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago