Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostCSS config, plugins as an object (as opposed to an array) fails #21

Open
exalted opened this issue Mar 16, 2021 · 1 comment
Open

Comments

@exalted
Copy link

exalted commented Mar 16, 2021

With the following postcss.config.js:

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
};

This gem fails with the following message:

Configuration file: /Users/foo/project/_config.yml
            Source: /Users/foo/project
       Destination: /Users/foo/project/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
PostCSS Server listening on port 8124...
/Users/foo/project/node_modules/postcss/lib/processor.js:60
        throw new Error(i + ' is not a PostCSS plugin')
        ^

Error: [object Object] is not a PostCSS plugin
    at Processor.normalize (/Users/foo/project/node_modules/postcss/lib/processor.js:60:15)
    at new Processor (/Users/foo/project/node_modules/postcss/lib/processor.js:9:25)
    at postcss (/Users/foo/project/node_modules/postcss/lib/postcss.js:25:10)
    at Function.process (/Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-postcss-0.4.0/bin/postcss:9:5)
    at Socket.<anonymous> (/Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-postcss-0.4.0/bin/postcss:21:14)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
  Conversion error: Jekyll::Converters::PostCss encountered an error while converting 'styles.css':
                    undefined method `chomp' for nil:NilClass
                    ------------------------------------------------
      Jekyll 4.2.0   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
Traceback (most recent call last):
	43: from /Users/ali/.rbenv/versions/2.7.2/bin/bundle:23:in `<main>'
	42: from /Users/ali/.rbenv/versions/2.7.2/bin/bundle:23:in `load'
	41: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/exe/bundle:37:in `<top (required)>'
	40: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
	39: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/exe/bundle:49:in `block in <top (required)>'
	38: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli.rb:24:in `start'
	37: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	36: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli.rb:30:in `dispatch'
	35: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	34: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	33: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	32: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli.rb:494:in `exec'
	31: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:28:in `run'
	30: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:63:in `kernel_load'
	29: from /Users/ali/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:63:in `load'
	28: from /Users/foo/project/vendor/bundle/ruby/2.7.0/bin/jekyll:23:in `<top (required)>'
	27: from /Users/foo/project/vendor/bundle/ruby/2.7.0/bin/jekyll:23:in `load'
	26: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
	25: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
	24: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
	23: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
	22: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
	21: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
	20: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
	19: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
	18: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
	17: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
	16: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
	15: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
	14: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
	13: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:80:in `process'
	12: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:211:in `render'
	11: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:538:in `render_pages'
	10: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:538:in `each'
	 9: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:539:in `block in render_pages'
	 8: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:547:in `render_regenerated'
	 7: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:63:in `run'
	 6: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:84:in `render_document'
	 5: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `convert'
	 4: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `reduce'
	 3: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:104:in `each'
	 2: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-4.2.0/lib/jekyll/renderer.rb:106:in `block in convert'
	 1: from /Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-postcss-0.4.0/lib/jekyll/converters/postcss.rb:41:in `convert'
/Users/foo/project/vendor/bundle/ruby/2.7.0/gems/jekyll-postcss-0.4.0/lib/jekyll-postcss/socket.rb:28:in `read': undefined method `chomp' for nil:NilClass (NoMethodError)
error: Script failed: see failed command above

However this syntax works as expected:

module.exports = {
  plugins: [
    require('tailwindcss'),
    require('autoprefixer'),
  ],
};
@aschrijver
Copy link

aschrijver commented Mar 22, 2021

I can confirm. Just got the same error. (Jekyll 4.2.0 too)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants