-
Notifications
You must be signed in to change notification settings - Fork 186
rails tailwindcss:watch issue on Windows 10 / Sprockets::Rails::Helper::AssetNotPrecompiledError #118
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
Comments
Running foreman manually fails for the same reason you can't run It should also be noted that the suggested action by Rails (adding |
I'm experiencing the same problem with Windows 10. The workaround removed the error. |
I've modified the gem on my machine so the rake build task ( TAILWIND_COMPILE_COMMAND = "#{Pathname.new(__dir__).to_s}/../../exe/tailwindcss -i #{Rails.root.join("app/assets/stylesheets/application.tailwind.css")} -o #{Rails.root.join("app/assets/builds/tailwind.css")} -c #{Rails.root.join("config/tailwind.config.js")} --minify"
namespace :tailwindcss do
desc "Build your Tailwind CSS"
task :build do
system "ruby " + TAILWIND_COMPILE_COMMAND
end
desc "Watch and build your Tailwind CSS on file changes"
task :watch do
system "ruby #{TAILWIND_COMPILE_COMMAND} -w"
end
end
Rake::Task["assets:precompile"].enhance(["tailwindcss:build"])
if Rake::Task.task_defined?("test:prepare")
Rake::Task["test:prepare"].enhance(["tailwindcss:build"])
elsif Rake::Task.task_defined?("db:test:prepare")
Rake::Task["db:test:prepare"].enhance(["tailwindcss:build"])
end Now, |
I don't know if this is a tailwindcss-rails issue or something else - I'm a bit rusty as a Rails dev now, but hopefully this issue helps someone else as a workaround.
A fresh install of Rails 7 on Ruby 2.7.5 x64-mingw32 (Windows 10) with --css=tailwind and slim templates gives Sprockets::Rails::Helper::AssetNotPrecompiledError in development.
application.html.slim:
bin/dev
is a bash script and doesn't run on Windows, but it just installs and runs foreman.foreman start -f Procfile.dev
throws an errorrails tailwindcss:watch
runs and quits without an error and without building tailwind.cssThe workaround is to manually run
tailwindcss -i app/assets/stylesheets/application.tailwind.css -o app/assets/builds/tailwind.css -c config/tailwind.config.js -w
which works okay, and builds tailwind.css in app/assets/builds so the app doesn't throw an exception.The text was updated successfully, but these errors were encountered: