Skip to content

Commit c849173

Browse files
committed
Enable JIT compiler for Tailwind
Ok that turned out to be easier than expected. A bit of Googling lead to a blog post where someone mentioned to do this, and now it works!
1 parent cd0c763 commit c849173

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
2929
- Update PostgreSQL from `13.2` to `13.3`
3030
- Update Redis from `6.0.10` to `6.2.3`
3131
- Use new packs directory structure recommended by Webpacker 6
32+
- Enable JIT compiler for TailwindCSS
3233
- Move `tailwind.config.js` to the root of the project
3334

3435
### Fixed

config/application.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ class Application < Rails::Application
3535
config.action_cable.allowed_request_origins = origins
3636
end
3737
end
38+
39+
# Ensure the TailwindCSS JIT compiler exits properly.
40+
Webpacker::Compiler.env["TAILWIND_MODE"] = "build"

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
//mode: "jit",
2+
mode: "jit",
33
purge: {
44
enabled: ["production"].includes(process.env.NODE_ENV),
55
content: [

0 commit comments

Comments
 (0)