Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per-server conditional asset precompilation #174

Closed
wants to merge 3 commits into from
Closed

Per-server conditional asset precompilation #174

wants to merge 3 commits into from

Conversation

2-718
Copy link

@2-718 2-718 commented Mar 3, 2012

This pull request implements conditional asset precompilation on a per-server basis (the check is conducted server-side to properly allow parallel deployment). I added String#unindent to facilitate heredoc whitespace cleanup.

@pyrat
Copy link

pyrat commented Mar 27, 2012

+1 for this, as asset precompilation takes at least 30 seconds, this is a pain unless needed. Having this baked into capistrano would be a big help.

@antage
Copy link

antage commented Apr 17, 2012

If I update jquery-rails gem (for example) to a new version, capistrano with this patch doesn't recompile assets.
I suggest to check Gemfile.lock. Any changes in Gemfile.lock should trigger assets rebuilding.

@cgriego
Copy link
Contributor

cgriego commented Jun 1, 2012

Could this instead be implemented as a Rails plugin that overloads the asset compilation Rake task? Seems useful outside the context of just Capistrano deployments, works with existing infrastructure, and then you have the power of Ruby and not just bash and have a shot of detecting gem changes.

@jrochkind
Copy link
Contributor

Yeah, the problem with just doing a diff of ./{app|vendor|lib}/assets is that assets can come from gems too. For instance, jquery-rails. One can imagine complicated workarounds, involving gem dependency changes (but if any gem dependency change triggers asset precompile.... you will be avoiding compile infrequently). Or a hook into rails that checks all the source asset_paths, yeah.

I think the different approach, within Rails, being taken by @ndbroadbent in rails/sprockets-rails#21 is probably the more realistic solution, esp since @ndbroadbent has actually done the work. If anyone has the time to spend on it, it would probably be a good use of that time to help them get that patch into rails, by testing etc.

@ndbroadbent
Copy link
Contributor

Hey @jrochkind, thanks for the mention!
I'd also like to point out that I've released this as a gem for Rails 3, called turbo-sprockets-rails3. It overrides sprockets so that only changed assets are precompiled, and nondigest assets are quickly generated from the precompiled assets (so you only need to compile assets once, instead of twice.)
You can use it in your Rails 3.2.x application by adding gem 'turbo-sprockets-rails3' to your Gemfile, and I'd really appreciate it if you could help me test it out. Please open an issue if you run into any problems.

Cheers!

@carsomyr
Copy link
Contributor

carsomyr commented Oct 2, 2012

I'm closing this PR and directing further discussion to issue #227.

@carsomyr carsomyr closed this Oct 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants