ndbroadbent/turbo-sprockets-rails3

Rails 4 ?

kristianmandrup opened this issue · 8 comments

turbo-sprockets-rails4 ???

Hi there, turbo-sprockets-rails3 was created to solve a problem with the Rails 3 asset pipeline. These problems have all been solved in Rails 4, so the gem will not be necessary. Thanks :)

@ndbroadbent, can you elaborate on how this problem has been solved in Rails 4? Do you mean by virtue of sprockets not being packaged with Rails anymore?

Hi @maletor,

The main reason is that non-digest assets are no longer being compiled, so the assets cache is not cleared between runs. This also means that the cache can be re-used between environments, such as development and production. So if you are developing on your local machine, and then run assets:precompile, it will finish almost instantly.

I think the heroku buildpack might still need to be tweaked so that it stores and reuses the assets cache between pushes, but that's a different issue.

Really?

Rails 4.0.0, Ruby 2.0.0-p247:

$ time rake assets:precompile
...
real 17m41.451s 
user 14m42.228s 
sys 0m4.088s

@canweriotnow how about if you run it again?

I'm on a newer machine, now between 5-8 min. on rake assets:precompile. CSS seems to take th longest (previously I was operating on a theroy of multiple jQuery compilations), I think it might be the Less engine from twitter-bootstrap-rails, going to try switching out to the sass-ified bootstrap gem and see if that helps.

@canweriotnow just saw your comment - did your switch accelerate the precompile time? Thanks!

We upgraded our app to Rails 4 last year and were pretty disappointed at how slow asset precompilation was, especially considering the speed and caching issues were supposed to have been solved. We ended up writing some code to precompile assets in parallel, which sped up precomp by quite a bit. I just extracted and published the code as turbo-sprockets-rails4, which is available here. Your mileage may vary 😉