mhanberg / jekyll-postcss

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

Add configuration option to disable caching. #32

Closed tristandunn closed 2 years ago

tristandunn commented 2 years ago

Caching the compiled CSS makes sense 99% of the time, but I recently ran into a situation where it's better to have it disabled: Using TailwindCSS in JIT mode. Jekyll will recompile the CSS every time any file is changed, but the caching is preventing TailwindCSS from running to actually update the CSS.

An overview of what happens in this case with caching enabled might help explain it better:

  1. Jekyll is started and PostCSS runs, compiling and caching the CSS.
  2. You change a class name in an HTML file.
  3. Jekyll recompiles the HTML and CSS, but PostCSS is not run and the cached CSS is used.
  4. The new class name has no effect since it's not added to the CSS.

Other Changes

I included two other small changes, one is a bug fix for using TailwindCSS and one is a small tweak:

Let me know if you'd prefer the the bin/postcss as a separate PR and I can split them up.