Skip to content

Instantly share code, notes, and snippets.

@juliocesar
Created May 9, 2012 00:33
Show Gist options
  • Save juliocesar/2640720 to your computer and use it in GitHub Desktop.
Save juliocesar/2640720 to your computer and use it in GitHub Desktop.
get '/scripts.js' do
content_type 'application/javascript'
these, scripts = params[:these].split(',').map { |s| s + '*' }.join(','), []
Dir.chdir Sinatra::Application.root + '/public/js'
Dir["{#{these}}.js"].each do |script|
scripts << File.read(script)
end
scripts.join(";")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment