From 751a5111af09607b4ce719450824fd4bdde7bf84 Mon Sep 17 00:00:00 2001 From: Bruno Sutic Date: Thu, 18 Apr 2024 14:43:14 +0200 Subject: [PATCH] Engine server hook --- lib/tailwindcss/engine.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/tailwindcss/engine.rb b/lib/tailwindcss/engine.rb index 4b9b9fdc..4fead1a6 100644 --- a/lib/tailwindcss/engine.rb +++ b/lib/tailwindcss/engine.rb @@ -13,5 +13,14 @@ class Engine < ::Rails::Engine config.app_generators do |g| g.template_engine :tailwindcss end + + server do + tailwind_pid = fork do + exec(*Tailwindcss::Commands.watch_command(always: true)) + end + at_exit do + Process.kill(:INT, tailwind_pid) + end + end end end