How assets precompile in development environment on ruby on rails?

user5326892 picture user5326892 · Sep 17, 2015 · Viewed 23.5k times · Source

Why can't we precompile assets in a development environment? I know that sprockets basically compile all assets.

When we go in production environment then we run the command:

rake assets:precompile

But in the development env we can't do anything for it to compile itself. What are difference in behavior of assets compilation in both environment?

Answer

Alexander Shlenchack picture Alexander Shlenchack · Sep 17, 2015

If you want to precompile assets in development environment you can use this command:

RAILS_ENV=development bundle exec rake assets:precompile

You can precompile assets in development environment by default using config/development.rb

config.assets.debug = false

In most cases you don't need it because your development process will be more hard.