Skip to content

Instantly share code, notes, and snippets.

@alexyoung
Created June 2, 2010 11:30
Show Gist options
  • Save alexyoung/422242 to your computer and use it in GitHub Desktop.
Save alexyoung/422242 to your computer and use it in GitHub Desktop.
class SprocketsController < ActionController::Base
caches_page :show, :if => Proc.new { SprocketsApplication.use_page_caching }
def show
render :text => minify(SprocketsApplication.source), :content_type => "text/javascript"
end
private
def minify(source)
JSMin.minify source
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment