On Tuesday, October 22, 2013 4:20:34 AM UTC-4, oli...@eboutic.ch wrote:
>
> Hi, If I good understand, Rails 4 compile only changed assets ? Like 
> gem turbo-sprockets-rails3 ? In this case, I don't understand why launch 2 
> times 'rake assets:precompile', take same time (~10min). Result a very slow 
> deploy...
>

Yes, in theory, that's the way it works.  There are a number of things that 
could be going on.  

Your long compile time could be a number of issues.  I would start with the 
easiest which is corrupted caches.  Run the following:

rake assets:clean assets:clobber

This wipes everything out.  Now run rake assets:precompile.  This will be a 
long one since everything is being compiled.  After that, you should be 
able to make a change and only the changed asset will be recompiled.

If you're still having long run times, you may need to clean things up. 
 There are several suggestions I could make:

1)  I only include images in the asset pipeline that get used on every page 
or the majority of pages such as a logo, background for a header, etc. 
 Images that only get used on one page I keep in public/images and refer to 
them statically.  The reason for this is that every image in the 
app/assets/images directory gets fingerprinted and copied to 
/public/assets.  The only advantage to this is that the images are 
pre-loaded in the browser.  However, it pre-loads them on every page, 
regardless of whether that page uses the images or not.  To me, this is a 
lot of overhead and for images that I use only on one page or in one area I 
don't run through the pipeline.

2) Watch your filenames.  Don't name a stylesheet mystylesheet.css.scss if, 
in fact, the file only contains only CSS and no SASS code in it.  It will 
unnecessarily get pre-processed when no pre-processing is required.  Same 
goes for erb & coffee.  

3)  This is a personal belief, a lot of developers would disagree, but I 
don't ever use require_tree or require_directory in the manifest.  First, 
with stylesheets, order is important so I need to require stylesheets in 
the right order and second, I want to be sure that only stylesheets and 
javascript I specifically require are included.

4) You may have issues with your deployment tool.  Capistrano, at one 
point, was touching every asset causing the pipeline to completely 
recompile regardless of whether changes had been made or not.  I believe 
this was fixed, but I'm not positive.  

Beyond this, I'm open for other's comments.  Hopefully, some of these 
suggestions will help improve your times.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dff25618-d4ed-479a-b425-a840f3c6b618%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to