1

I precompiled my files in the asset pipeline after upgrading to rails 3.1 (and later to 3.2) Now (working in development mode) I have to recompile them after every change to see them appear. As this takes about one minute, development is nearly impossible.

I have made the following relevant entries in config/development.rb

config.cache_classes = false # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false # Do not compress assets config.assets.compress = false config.assets.compile = true # Expands the lines which load the assets config.assets.debug = true # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.3 # configuration option config.assets.logger to control Sprockets logging config.assets.logger = nil 

What is wrong? How can I see the changes i make in application.js and others suddenly?

2
  • 1
    Have you delete file from your public/assets generation ? Commented Mar 16, 2012 at 9:31
  • Have you made the relevant changes to development.rb and restarted rails s? Commented Mar 16, 2012 at 9:38

2 Answers 2

3

One has to manually do

 $ bundle exec rake assets:clean 

Which will remove all files in [app]/public/assets/. (Caution with otherfiles there, belonging to a model (like users pics), they also get removed!).

When the files do not exist the original ones are used. So precompiling assets seems not necessary for development mode.

Thanks @shingara for the hint in his comment to the question.

Sign up to request clarification or add additional context in comments.

2 Comments

This answer is correct - do not precompile locally. You should check that all your config options match those in the asset pipeline guides upgrade section, and things should 'just work'.
@Richard, it still doesn't 'just work' for me. See this question.
0

Something which might be a factor is if the following directive is in config/application.rb:

config.assets.precompile += [ 'asset-file', ... ] 

This should either be limited to 'fixed' asset files, or moved to config/environments/production.rb.

Not sure if that is happening with your situation, however it would produce similar results of not seeing changes after editing the asset file. Not precompiling assets will save you from needing to compile them each iteration in development.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.