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

Add configuration option to disable caching. #32

merged 4 commits into from Sep 11, 2021

Add configuration option to disable caching. #32

merged 4 commits into from Sep 11, 2021


Copy link

@tristandunn tristandunn commented Sep 10, 2021

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:

  • I removed the stdin source in bin/postcss. This was throwing an error when using TailwindCSS. A workaround is to create an stdin file in the root, but this seems more sane. This fixes @tailwindcss/jit doesn't work #22. (See 5fa94692).
  • I slightly tweaked the cache_miss method to help it read a bit better with the cache disabled condition.

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

@mhanberg mhanberg self-assigned this Sep 11, 2021 Outdated Show resolved Hide resolved
@mhanberg mhanberg merged commit 001ce9f into mhanberg:main Sep 11, 2021
@tristandunn tristandunn deleted the td-caching-option branch September 11, 2021 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

@tailwindcss/jit doesn't work
2 participants