找不到带有postcss的模块styles.css

时间:2018-07-30 18:43:05

标签: postcss autoprefixer postcss-cli

我正在按照以下示例快速介绍Postcss:

https://www.sitepoint.com/an-introduction-to-postcss/

在全局安装postcssautoprefixer之后,在项目的根目录中创建一个styles.css文件并运行以下命令:

postcss -u autoprefixer styles.css -d public

我得到了错误:

Plugin Error: Cannot find module 'styles.css'

为什么认为这是插件错误?

1 个答案:

答案 0 :(得分:1)

遇到了同样的问题并找到了以下相关帖子:Autoprefixer errors with NPM (✖ Plugin Error: Cannot find module )

我运行的命令是

postcss styles.css -d dist -u autoprefixer

如相关答案所示,-u现在需要多个插件,因此必须修改顺序。

如果您使用的是该教程,则示例为“ display:flex;”。不再有用,因为它将在所有浏览器中“按原样”运行。改为使用

::placeholder {
  color: gray;
}

测试自动前缀