docs(README): fix the gulp example - #279
Merged
Merged
Conversation
The example required gulp-postcssrc, which is not on npm, had a leftover ")" that made it a syntax error, and did not return the stream, so gulp stopped with "Did you forget to signal async completion?". Use gulp-postcss, which loads postcss.config.js through postcss-load-config, and return the stream.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gulp example in the README could not run:
gulp-postcssrc, which is not on npm (the registry answers 404; Default option #18 calls it a proof of concept that "will stay unpublished"), so it fails withCannot find module 'gulp-postcssrc'.})after thecssfunction is left over from 0f26c60, whentask('css', () => { ... })becameconst css = () => { ... }, so Node stops withSyntaxError: Unexpected token ')'.cssdoes not return the stream, so gulp reportsThe following tasks did not complete: default, cssandDid you forget to signal async completion?, andwatchnever starts.It now uses
gulp-postcss, which loadspostcss.config.jsthrough postcss-load-config when it gets no plugins, and returns the stream.I ran the fixed example with gulp 5.0.1, gulp-postcss 10.0.0 and the README's
postcss.config.js, on a file with@importand nesting. WithNODE_ENV=productionit writes.imported{color:blue}.card{color:red}.card .title{margin:0}, withNODE_ENV=developmentthe same CSS without cssnano, thenwatchstarts and rebuilds after a change. The example frommainfails with theSyntaxErrorabove, and the fixed one fails as described withoutreturnor withgulp-postcssrc.