uswds / uswds-gulp

A simple Gulp 4.0 workflow for transforming USWDS Sass into browser-readable CSS.
Other
35 stars 17 forks source link

Latest Autoprefixer (v. 10) throws error on init #26

Closed taylorsolomon closed 3 years ago

taylorsolomon commented 3 years ago

Following the installation instructions today now gives this error once you gulp init:

Message:
    [object Object] is not a PostCSS plugin

This is (I think) due to autoprefixer 10 releasing recently, which depends on Postcss 8, featuring a whole new plugin API. This theoretically should resolve itself once https://github.com/postcss/gulp-postcss/issues/161 is resolved.

thisisdano commented 3 years ago

Would it work (for now) if we pinned the autoprefixer package to 9.8.6 like autoprefixer@^9.8.6?

taylorsolomon commented 3 years ago

Running autoprefixer 9.8.6 resolves the issue.

Autoprefixer is already pinned at ^9.8.6 in the main branch, but it's as a peerDependency.

Best bet may be to update the README to include specific versions for when you "one line install" dependencies

Add all the required dependencies at once with following command from your project's root directory:

npm install autoprefixer gulp gulp-replace sass gulp-sass gulp-sourcemaps gulp-postcss postcss-csso uswds uswds-gulp@github:uswds/uswds-gulp --save-dev

To handle the postcss upgrade you could change that to have specific versions requested for the postcss-related items, e.g.:

npm install autoprefixer@^9.8.6 gulp gulp-replace sass gulp-sass gulp-sourcemaps gulp-postcss@^8.0.0 postcss-csso@^4.0.0 uswds uswds-gulp@github:uswds/uswds-gulp --save-dev

I can confirm that this example resolves the issue.

Since all dependencies are peerDependencies it may make sense to have a disclaimer in the README explaining that all dependencies are peerDependencies and the gulpfile, as written, relies on a couple specific dependency versions.

thisisdano commented 3 years ago

Thanks — that's what I plan to do!