diff options
author | 2021-07-31 02:45:56 -0300 | |
---|---|---|
committer | 2021-07-30 22:45:56 -0700 | |
commit | 5e9a47ffbc9c7d7e668bbe548a57a758dcbdff98 (patch) | |
tree | e160b1bb3cc8ba8fb25e072fc7bdba7a7692f64c /docs/src/pages/guides/styling.md | |
parent | 758f172708055514a2878762a3a2a626dc26a0c3 (diff) | |
download | astro-5e9a47ffbc9c7d7e668bbe548a57a758dcbdff98.tar.gz astro-5e9a47ffbc9c7d7e668bbe548a57a758dcbdff98.tar.zst astro-5e9a47ffbc9c7d7e668bbe548a57a758dcbdff98.zip |
📘 DOC: Add PostCSS configuration on Astro (#947)
Diffstat (limited to 'docs/src/pages/guides/styling.md')
-rw-r--r-- | docs/src/pages/guides/styling.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/src/pages/guides/styling.md b/docs/src/pages/guides/styling.md index ccc0ef5f6..cbf1e2713 100644 --- a/docs/src/pages/guides/styling.md +++ b/docs/src/pages/guides/styling.md @@ -166,6 +166,33 @@ If you want to import third-party libraries into an Astro component, you can use </style> ``` +### 🎠PostCSS + +[PostCSS](https://postcss.org/) is a popular CSS transpiler with support for [a huge ecosystem of plugins.](https://github.com/postcss/postcss#plugins) + +**To use PostCSS with Snowpack:** add the [@snowpack/plugin-postcss](https://www.npmjs.com/package/@snowpack/plugin-postcss) plugin to your project. + +```diff +// snowpack.config.js +"plugins": [ ++ "@snowpack/plugin-postcss" +] +``` + +PostCSS requires a [`postcss.config.js`](https://github.com/postcss/postcss#usage) file in your project. By default, the plugin looks in the root directory of your project, but you can customize this yourself with the `config` option. See [the plugin README](https://www.npmjs.com/package/@snowpack/plugin-postcss) for all available options. + +```js +// postcss.config.js +// Example (empty) postcss config file +module.exports = { + plugins: [ + // ... + ], +}; +``` + +Be aware that this plugin will run on all CSS in your project, including any files that compiled to CSS (like `.scss` Sass files, for example). + ## Bundling All CSS is minified and bundled automatically for you in running `astro build`. Without getting too in the weeds, the general rules are: |