mhanberg / jekyll-postcss

A plugin to use PostCSS plugins like Autoprefixer or Tailwind CSS with Jekyll.
MIT License
67 stars 12 forks source link

Running "bundle exec jekyll serve" freezes on "Requiring: jekyll-postcss" #37

Open AndrewPetz opened 2 years ago

AndrewPetz commented 2 years ago

Platform: Windows

I'm trying to get TailwindCSS working with my new Jekyll project, and when I run bundle exec jekyll serve --verbose it freezes. Force-quitting the process with ctrl+c displays the following:

$ bundle exec jekyll serve --verbose
  Logging at level: debug
    Jekyll Version: 4.2.2
Configuration file: xxxxxxxxx/_config.yml
  Logging at level: debug
    Jekyll Version: 4.2.2
         Requiring: jekyll-feed
         Requiring: jekyll-postcss
                    ------------------------------------------------
      Jekyll 4.2.2   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.
                    ------------------------------------------------
Traceback (most recent call last):
        29: from C:/Ruby27-x64/bin/jekyll:23:in `<main>'
        28: from C:/Ruby27-x64/bin/jekyll:23:in `load'
        27: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
        26: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
        25: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
        24: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
        23: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
        22: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
        21: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
        20: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
        19: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
        18: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
        17: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:30:in `process'
        16: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:30:in `new'
        15: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:36:in `initialize'
        14: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:133:in `setup'
        13: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:319:in `instantiate_subclasses'
        12: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:319:in `tap'
        11: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:321:in `block in instantiate_subclasses'
        10: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:321:in `map!'
         9: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:321:in `block (2 levels) in instantiate_subclasses'
         8: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.2/lib/jekyll/site.rb:321:in `new'
         7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll/converters/postcss.rb:16:in `initialize'
         6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll/converters/postcss.rb:16:in `fetch'
         5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll/converters/postcss.rb:16:in `block in initialize'
         4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll/converters/postcss.rb:16:in `new'
         3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll-postcss/socket.rb:13:in `initialize'
         2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll-postcss/socket.rb:62:in `start_dev_server'
         1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll-postcss/socket.rb:62:in `open'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-postcss-0.5.0/lib/jekyll-postcss/socket.rb:62:in `initialize': Interrupt

Here are all of my current config files, with what I believe are irrelevant lines stripped out:

_config.yml:

# Build settings
plugins:
  - jekyll-feed
  - jekyll-postcss

# example from https://github.com/stefcoetzee/jekyll-tailwind/blob/main/_config.yml
sass:
  sourcemap: never

# disable caching for Tailwind JIT
postcss:
  cache: false

# files Jekyll should not delete from .site
keep_files:
  - css/tailwind.css
  - css/tailwind.css.map

postcss.config.js

module.exports = {
    plugins: [
        require('postcss-import'),
        require('tailwindcss'),
        require('autoprefixer'),
        ...(process.env.JEKYLL_ENV == "production"
            ? [require('cssnano')({ preset: 'default' })]
            : [])
    ]
};

tailwind.config.js

module.exports = {
  content: [
    './_includes/**/*.html',
    './_layouts/**/*.html',
    './_posts/*.md',
    './*.html',
  ],
  theme: {
    extend: {}
  },
  variants: {},
  plugins: [
    require('@tailwindcss/typography'),
  ],
}

I'm happy to include any other details that you might need.

leafleaf90 commented 2 years ago

Did you solve this? I have the same issue.

PatricNox commented 2 years ago

Same issue here, the build & serve command from Jekyll freezes on init.

bundle exec jekyll serve


Configuration file: C:/project/_config.yml
  Logging at level: debug
    Jekyll Version: 4.3.1
          Requiring: jekyll-postcss
PatricNox commented 2 years ago

Did you solve this? I have the same issue.

I solved it, after trying to find a solution for soon 1.5 hours, by using this instead. https://github.com/bglw/jekyll-postcss-v2

same setup: add in gem, add in plugins, same postcss.config.js file.

PwrSrg commented 7 months ago

Same issue here. Couldn't get jekyll-postcss-v2 to work either no matter what I tried. Been at it for hours.

zsilliman commented 3 months ago

I got it working by running npm i postcss postcss-cli