lib/sinatra/support/jssupport.rb in sinatra-support-1.0.1 vs lib/sinatra/support/jssupport.rb in sinatra-support-1.0.2
- old
+ new
@@ -2,28 +2,35 @@
#
# == Usage
#
# require 'sinatra/support/jssupport'
#
-# Use {#serve_js} in the Sinatra DSL to serve up files.
+# class Main < Sinatra::Base
+# register Sinatra::JsSupport
+# serve_js '/js', from: './app/js'
+# end
#
-# register Sinatra::JsSupport
-# serve_js '/js', from: './app/js'
+# You'll be able to access files via +/js+:
#
-# Assuming you have a +app/js/jquery.js+ file, you will
-# then be able to access it from the given URL prefix.
-#
+# # This will serve /app/js/jquery.js. (or .coffee)
# $ curl "http://localhost:4567/js/jquery.js"
#
+# == CoffeeScript support
+#
# This plugin supports CoffeeScript. To use it, simply
# add a CoffeeScript file in the JS file path.
#
# # Will first try app/js/application.coffee,
# # then move onto app/js/application.js if it's not found.
#
# $ curl "http://localhost:4567/js/application.js"
#
-# To use CoffeeScript, you will need the +coffee_script+ gem.
+# To use CoffeeScript, install the +coffee_script+ gem.
+# If you're using Bundler, that is:
+#
+# # Gemfile
+# gem "coffee-script", require: "coffee_script"
+#
#
module Sinatra::JsSupport
def self.registered(app)
app.set :js_max_age, app.development? ? 0 : 86400*30
end