diff --git a/lib/install/Procfile.dev b/lib/install/Procfile.dev index 023e98a0..cd230fc6 100644 --- a/lib/install/Procfile.dev +++ b/lib/install/Procfile.dev @@ -1,2 +1,3 @@ web: bin/rails server -p 3000 css: bin/rails tailwindcss:watch +css_polling: bin/rails tailwindcss:poll diff --git a/lib/install/dev b/lib/install/dev index 2daf7764..b1f85435 100755 --- a/lib/install/dev +++ b/lib/install/dev @@ -6,4 +6,19 @@ then gem install foreman fi -foreman start -f Procfile.dev +while getopts "p" option +do + case "${option}" + in + p)polling=1;; + *);; + esac +done + +if [ $polling -eq 1 ] +then + echo "[INFO] Enabled polling for css processing!" + foreman start -f Procfile.dev -m all=1,css=0 +else + foreman start -f Procfile.dev -m all=1,css_polling=0 +fi diff --git a/lib/tasks/build.rake b/lib/tasks/build.rake index 760a478e..76906d3a 100644 --- a/lib/tasks/build.rake +++ b/lib/tasks/build.rake @@ -6,10 +6,15 @@ namespace :tailwindcss do system TAILWIND_COMPILE_COMMAND end - desc "Watch and build your Tailwind CSS on file changes" + desc "Watch and build your Tailwind CSS on file changes (using filesystem events)" task :watch do system "#{TAILWIND_COMPILE_COMMAND} -w" end + + desc "Watch and build your Tailwind CSS on file changes (using polling)" + task :poll do + system "#{TAILWIND_COMPILE_COMMAND} -p" + end end Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])