Skip to content

Instantly share code, notes, and snippets.

@mikedamage
Created January 28, 2009 03:42
Show Gist options
  • Save mikedamage/53800 to your computer and use it in GitHub Desktop.
Save mikedamage/53800 to your computer and use it in GitHub Desktop.
# = Sinatra Action: Minify Javascript
#
# == Summary
# Takes JS files from the public directory and minifies them using the JSMin Rubygem
get '/js/minify/:file' do
content_type 'text/javascript', :charset => 'utf-8'
@file = Pathname.new("./public/javascripts/" + params[:file])
@mini = JSMin.minify(@file.read)
@mini
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment