4

I am following this example for a quick intro to postcss:

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

After installing postcss and autoprefixer globally, creating a styles.css file in the root of my project and running the following command:

postcss -u autoprefixer styles.css -d public

I get the error:

Plugin Error: Cannot find module 'styles.css'

Why does it think it is is a plugin error?

HGB
  • 2,157
  • 8
  • 43
  • 74

1 Answers1

2

Had the same issue & found this related post: Autoprefixer errors with NPM (✖ Plugin Error: Cannot find module )

The command I ran is

postcss styles.css -d dist -u autoprefixer

As the related answer shows, -u now takes multiple plugins so the order has to be modified.

Also if you use that tutorial, the example of "display: flex;" is no longer useful as it will work "as is" across browsers. Instead use

::placeholder {
  color: gray;
}

to test autoprefixer

E Allison
  • 51
  • 6
  • how can I run this command but replace current css file with new, in a project with 100ds of .css files? I tried this: `npx postcss ./src/**/*.css -d dist -u autoprefixer` – George Mylonas Jul 05 '19 at 13:45