PostCSS
PostCSS is a popular CSS transpiler with support for a huge ecosystem of plugins.
To use PostCSS with Snowpack: add the @snowpack/plugin-postcss plugin to your project.
// snowpack.config.mjs
export default {
plugins: [
+ '@snowpack/plugin-postcss',
],
};
PostCSS requires a postcss.config.js
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 for all available options.
// 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).