理解 post-css grunt 插件和 autoprefixer 之间的关系

understanding relation between post-css grunt plugin and autoprefixer

大家好,我只是在玩 grunt,偶然发现了这个强大的插件 HERE,grunt-postcss。它是一个非常强大的插件,它帮助我毫不费力地为动画文件添加前缀(我想这就是 grunt 的全部意义所在。)。无论如何,现在我看到以下针对 post-css 的命令行说明。

$ npm install grunt-postcss pixrem autoprefixer cssnano

如果我没记错的话 autoprefixer 是一个独立的 grunt 插件,已经贬值了,但它与 post-css 有什么关系?还有其他插件 I.E. pixrem cssnanopost-css 有什么关系?

谢谢。

确实autoprefixer是一个独立的插件,但是现在包含在postcss里面,出于性能原因:

Unlike the traditional approach with separate plugins, grunt-postcss allows you to parse and save CSS only once applying all post-processors in memory and thus reducing your build time. PostCSS is also a simple tool for writing your own CSS post-processors.

https://github.com/nDmitry/grunt-postcss#why-would-i-use-this

其他插件有什么作用,例如:pixremcssnano,与post-css有什么关系?

有额外的插件,您可以使用或不使用:

  • pixrem:为 rem 单位添加后备
  • cssnano: 缩小结果