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

Enable polling support for tailwindcss cli #168

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/install/Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
web: bin/rails server -p 3000
css: bin/rails tailwindcss:watch
css_polling: bin/rails tailwindcss:poll
17 changes: 16 additions & 1 deletion lib/install/dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion lib/tasks/build.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down