Hi
my Rails-7.0.4 app is not precompiling assets in development as expected
expected
it should refresh styles on browser reload in development
current behaviour
by example adding a style to app/assets/stylesheets/application.scss
i have to do rails assets:precompile
manually and then restart the server.
just precompile or just restart doesnt refresh the styles.
what i`ve done
i added config.assets.compile = true
to environments/development.rb
it changed nothing, and, i assume that this is default anyhow.
i also tested the gem hotwire-livereload
on changing views ist working super-fast and refreshes properly
but, refreshing the stylesheets it has no affect to the above mentioned behaviour
can it be i started with this app on Rails-7.0.2, updated then to rails-7.0.3, by changing the gem in the gemfile. Can that have an affect?
Thanks, Chris
CodePudding user response:
Now i built the whole app new rails new app-name
(v 7.0.3) and draged all contents from the previous app there. App is started by rails s
with the gem hotwire-livereload
, live-reloading included works like expected. So, i can not tell why, but it works now.
CodePudding user response:
Just run your server with bin/dev
instead of bin/rails s
Update
If you don't have this file you can add it to bin
folder
#!/usr/bin/env bash
if ! command -v foreman &> /dev/null
then
echo "Installing foreman..."
gem install foreman
fi
foreman start -f Procfile.dev
and Procfile.dev
in the root of your application
web: bin/rails server -p 3000
css: yarn build:css --watch