-1

I've been stuck in the error I encounter when I try to use autoprefixer to prefix my css. Below is my package.json file. Screenshot

{
  "name": "natours",
  "version": "1.0.0",
  "description": "Landing page for natours",
  "main": "index.js",
  "scripts": {
    "watch:sass": "node-sass sass/main.scss css/style.css -w",
    "compile:sass": "node-sass sass/main.scss css/style.comp.css",
    "concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css",
    "prefix:css": "postcss --use autoprefixer -b 'last 5 versions' css/style.concat.css -o css/style.prefix.css"
  },
  "author": "Kenny",
  "license": "ISC",
  "devDependencies": {
    "autoprefixer": "^9.7.1",
    "concat": "^1.0.3",
    "node-sass": "^4.12.0",
    "postcss-cli": "^6.1.3"
  }
}
  • You also need postcss in dev-dependencies you have only included postcss-cli – Ronak07 Nov 13 '19 at 07:07
  • I see, so what I did is I also installed postcss. npm install postcss --save-dev so that it is added as a dev dependencies and it did. But still I can't successfully prefix my css https://imgur.com/IVpODBn – Kenny Estrella Nov 13 '19 at 07:20

1 Answers1

0

I think you need to adjust the order of the command line arguments.

By looking at the documentation, one of the examples look like this:

postcss <input.css>... [OPTIONS] --dir <output-directory>

So if you move your input file to the beginning, it might do the trick:

postcss css/style.concat.css --use autoprefixer -b 'last 5 versions' -o css/style.prefix.css
Cody MacPixelface
  • 1,348
  • 10
  • 21