Skip to content

Instantly share code, notes, and snippets.

View mphalliday's full-sized avatar

Michael Halliday mphalliday

View GitHub Profile
@mrbongiolo
mrbongiolo / precompile.md
Last active February 27, 2023 00:16
HOW TO: Rails 4.2 add 'vendor/asset' to precompile list

To enable the precompilation of all non.js/.css assets within vendor/assets just add this to config/initializers/assets.rb:

Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }

Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.

If you need to precompile images only, you could use this:

Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
@jamiew
jamiew / Unicorn capistrano deploy.rb
Created October 6, 2010 07:36
bundler, memcached, chef, log tailing and delayed job workers
# capistrano deployment
require "bundler/capistrano"
require "capistrano/ext/multistage"
set :stages, %w(canary production)
set :default_stage, "canary"
set :application, "lolcats"
set :deploy_to, "/srv/#{application}"
# Our own variable where we deploy this app to
deploy_to = "/srv/example.com"
current_path = "#{deploy_to}/current"
shared_path = "#{deploy_to}/shared"
shared_bundler_gems_path = "#{shared_path}/bundler_gems"
# See http://unicorn.bogomips.org/Sandbox.html
# Helps ensure the correct unicorn_rails is used when upgrading with USR2
Unicorn::HttpServer::START_CTX[0] = "#{shared_bundler_gems_path}/bin/unicorn_rails"