Created
June 8, 2012 02:12
-
-
Save grafikchaos/2893057 to your computer and use it in GitHub Desktop.
precompile all CSS/JS assets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Precompile assets | |
# | |
# precompiles all CSS/JS assets in the app/assets b/c I'm lazy | |
# and I don't want to freaking update this every time we add/use | |
# sass or coffeescript files | |
# | |
# This strategy excludes the other default asset directories | |
# (lib/assets, vendor/assets) as well as any assets located | |
# in gems (which is okay b/c they can be called with an @import | |
# command or a manifest file) | |
# | |
# see http://stackoverflow.com/a/10110226 | |
config.assets.precompile << Proc.new { |path| | |
if path =~ /\.(css|js)\z/ | |
full_path = Rails.application.assets.resolve(path).to_path | |
app_assets_path = Rails.root.join('app', 'assets').to_path | |
if full_path.starts_with? app_assets_path | |
puts "including asset: " + full_path | |
true | |
else | |
puts "excluding asset: " + full_path | |
false | |
end | |
else | |
false | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment