Search code examples
ruby-on-railstailwind-cssstimulusjs

The changes in tailwind classes nor stimulus controller in ruby on rails project is not reflected automatically


I have a Ruby on Rails project every time I do changes to tailwind classes or to a stimulus controller I need to run

bundle exec rake assets:precompile
./bin/dev

I use yarn, jsbundling-rails [esbuild] my procfile

web: unset PORT && bin/rails server
js: yarn build --watch
css: yarn build:css --watch

Solution

  • You should use the following to remove compiled assets

    bin/rails assets:clobber
    

    And simply use:

    ./bin/dev
    

    as it will intelligently watch for changes and recompile only the changed files.