Sha256: 3ace99ef922dc9b304b7a3f914716a13242a9370ede18bdda7437d6abfda6a1e

Contents?: true

Size: 502 Bytes

Versions: 7

Compression:

Stored size: 502 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'sinatra'
require 'grope'
require 'json'

$grope = Grope::Env.new
$grope.load('http://fmarcia.info/jsmin/test.html')

get '/' do
  '<html><body><form action="/minify"><textarea name="js"></textarea><br><input type="submit"></form></body></html>'
end

get '/minify' do
  content_type 'application/json'
  
  $grope.all('//textarea')[1].value = params[:js]
  $grope.find('id("go")').click

  JSON.generate :result => $grope.all('//textarea')[2].value
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grope-0.2.2 examples/js_minifier_sinatra.rb
grope-0.2.0 examples/js_minifier_sinatra.rb
grope-0.1.4 examples/js_minifier_sinatra.rb
grope-0.1.3 examples/js_minifier_sinatra.rb
grope-0.1.2 examples/js_minifier_sinatra.rb
grope-0.1.1 examples/js_minifier_sinatra.rb
grope-0.0.4 examples/js_minifier_sinatra.rb