Search code examples
ruby-on-rails-3asset-pipelinedevelopment-environmentprecompiled

Rails 3 Asset Pipeline - Development Environment Conflict With public/assets Directory


Just to confirm, does running rake assets:precompile amalgamate all js and css files into application.css and application.js files under the public/assets directory? What is the purpose of this file? The reason I ask is because for some reason my development mode is running into a lot of asset loading conflicts with this file, but my production mode runs just fine. It seems that the only way I can get my application to serve assets properly in development environment is to delete these files.

Is there a configuration in my development.rb file that I can setup to prevent my application from relying on this file in development mode?


Solution

  • Using

    rake assets:precompile:primary RAILS_ENV=production
    

    instead of

    rake assets:precompile
    

    should prevent the assets without md5 being added to the public/assets directory - which should make sure the development mode assets are generated dynamically.

    Quote

    To stop the creation of the non-hashed filenames in public use:

    rake assets:precompile:primary RAILS_ENV=production
    

    from: Why does rails precompile task do non-digest assets