0
votes

Hi I have a Ruby on Rails 4 application with a Spree Engine.

The problem is that is it quite slow and every time I reload a page it takes a long time to load (9 seconds in the last attempt)

I saw on the spree github page that the issue is known and there is a solution where they suggest to precompile assets with bundle exec rake assets:precompile:nondigest command.

Unfortunately when I run this command the rake is aborted. I have run the command with trace

bundle exec rake assets:precompile:nondigest --trace rake aborted!

Don't know how to build task 'assets:precompile:nondigest' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task_manager.rb:49:in []' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:148:ininvoke_task' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:in block (2 levels) in top_level' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:ineach' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:in block in top_level' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:115:inrun_with_threads' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:100:in top_level' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:78:inblock in run' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:165:in standard_exception_handling' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:75:inrun' /home/luca/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/bin/rake:33:in <top (required)>' /home/luca/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:inload' /home/luca/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `'

I suspect that the solution of precompiling assests was optimised for Ruby on Rails 3 and it's not working with Rails 4.

Can you advise on how to resolve this or if you have alternatives to speed up the loading time?

Thanks in advance.

1

1 Answers

-1
votes

The correct command to run is actually the below and it was run without errors

bundle exec rake assets:precompile RAILS_ENV=development

Speed of loading page seems marginally faster.

WARNING: Using the precompile rake task in development will prevent any changes to asset files from being automatically loaded in when you reload the page. You must re-run the precompile task for changes to become available.**

Rails also provides the following rake task that will delete the entire public/assets directory, this can be helpful to clear out development assets before committing.

rake assets:clean