PostCSS是一款使用插件去轉換CSS的工具,有許多非常好用的插件,例如autoprefixer,cssnext以及CSS Modules。而上面列舉出的這些特性,都是由對應的postcss插件去實現的。而使用PostCSS則需要與webpack或者parcel結合起來。
在Parcel中使用PostCSS的方法:添加配置文件.postcssrc(JSON),.postcssrc.js或者是postcss.config.js
配置示例:
- increase code readability → Autoprefixer
- Use tomorrow's CSS ,today! → postcss-cssnext
- The end of global CSS → postcss-modules
- Avoid errors in your CSS → stylelint
- Powerful grid CSS → lost →lost
官方文檔: https://www.postcss.com.cn/
css優化插件文檔: https://www.cssnano.cn/