Question

After building a heavy javascript application (SPA) on top of rails, right now, we are getting some trouble with scalability in development mode as our app grows. There are over 650 javascript files at moment and everytime we need to reload the page it takes about 30 seconds to complete and download all of them.

enter image description here

I was wondering if rails have any configuration options to cache those assets (not compress) in development mode and when any of them gets changed it expire the asset cache. Here is the development.rb file configuration:

MyApp::Application.configure do
  config.cache_classes = false
  config.action_controller.perform_caching = false
  config.consider_all_requests_local = true
  config.assets.enabled = true
  config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
  config.assets.compress = false
  config.assets.debug = true
end

Probably that option exists, just let me know.

Thanks.

Was it helpful?

Solution

Already posted as a comment, but he liked the answer so here it comes again.

The simplest option is to set config.assets.debug to false, that will not compress the files, just concatenate.

As a side-note, Discourse has a large open source JavaScript based app (around 600 .js files currently) in Rails, https://github.com/discourse/discourse, maybe you can take a look there to see how they are handling it. Here's a blog post detailing some possible work arounds in Discourse, http://samsaffron.com/archive/2013/05/03/eliminating-my-trivial-inconveniences, look under "I spend time making the development environment fast".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top