C-Lodder / grunt-postcss

Apply several post-processors to your CSS using PostCSS.
MIT License
39 stars 7 forks source link

Autoprefixer not working #37

Closed Hlsgs closed 4 years ago

Hlsgs commented 4 years ago

I get this error:

Warning: [object Object] is not a PostCSS plugin Use --force to continue.
Here's my package.json: ``` { "name": "XXX", "version": "1.0.0", "private": true, "browserslist": [ "> 0.5%", "last 2 versions", "Firefox ESR", "not dead", "ie 11", "android >= 4", "Edge > 12" ], "devDependencies": { "@lodder/grunt-postcss": "^3.0.0", "autoprefixer": "^10.0.0", "cssnano": "^4.1.10", "grunt": "^1.3.0", "grunt-base64": "^0.1.0", "grunt-cache-bust": "^1.7.0", "grunt-concurrent": "^3.0.0", "grunt-contrib-clean": "^2.0.0", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-imagemin": "^4.0.0", "grunt-contrib-uglify": "^5.0.0", "grunt-contrib-watch": "^1.1.0", "grunt-datauri": "^0.4.0", "grunt-modernizr": "^3.0.1", "grunt-sass": "^3.1.0", "grunt-string-replace": "^1.3.1", "jit-grunt": "^0.10.0", "node-sass": "^4.14.1", "postcss-discard-comments": "^4.0.2" } } ```

I am new to your plugin, comming here from the original because it started failing with the same error after updating to Autoprefixer v10. Should we start using this repo instead of the original? Perhaps we should ask the original developer to relinquish control of said original repo to you?

C-Lodder commented 4 years ago

PostCSS is now a peer dependency, and peer dependencies don't actually get automatically installed, so you will need to install v8.x manually:

 npm i --save-dev postcss

Should we start using this repo instead of the original

Yes this is the newly maintained repo. The original has been archived and is no longer maintained.

Perhaps we should ask the original developer to relinquish control of said original repo to you?

Probably won't be necessary as this is the new fork that people are gradually starting to move over to. May be a bit confusing if they then have to revert back to the original.

Hlsgs commented 4 years ago

All good, thank you! Although I am new to your repo, your efforts are very much appreciated, kind Sir!

I took the liberty of opening https://github.com/postcss/postcss/issues/1427.

C-Lodder commented 4 years ago

Ahh nice, thank you :)

mbrodala commented 2 years ago

In my case I accidentally installed grunt-postcss instead of @lodder/grunt-postcss. :sweat_smile:

mindersainii commented 2 years ago

I removed grunt-postcss because it was giving that same issue [object object], then I installed @lodder/grunt-postcss, and now I am getting this new error "jit-grunt: Plugin for the "postcss" task not found." what could be the reason?

C-Lodder commented 2 years ago

@mindersainii I've never tested with jit-grunt, but please bare in mind that hasn't received an update for 6 years and a stable version (1.0.0) was never released.

In your jit-grunt config, did you set @lodder/grunt-postcss as the task? Something like this perhaps:

require('jit-grunt')(grunt, {
  foo: '@lodder/grunt-postcss',
});
mindersainii commented 2 years ago

@C-Lodder Thank you for the quick response, the issue was with jit-grunt. I got rid of jit-grunt and now everything is working fine.

Hlsgs commented 2 years ago

@mindersainii C-lodder's answer is on point. You don't need to drop jit-grunt if you add that code.