Disable Sprockets for Rails in Development Mode

Sprockets (is/are)? the technology in Rails 3.1 and up that combines your CSS and Javascript files into one CSS and Javascript file. It remains to be seen if this was a positive change or not. The argument is that the client only has to make one HTTP request instead of many for each file; this is a good thing. However, if you change one line in one of your Javascript files, the client then has to redownload the entire combined file instead of just the one Javascript file that you modified.

Regardless, you may want to disable Sprockets while you're developing your Rails application. This will aid in debugging.

Change...

<%= stylesheet_include_tag "application" %>
<%= javascript_include_tag "application" %>

to...

<%= stylesheet_include_tag "application", debug: Rails.env.development? %>
<%= javascript_include_tag "application", debug: Rails.env.development? %>

If you made it this far, you should follow me on Twitter.

-JP

comments powered by Disqus