Sha256: 03876d4000023041fc64ecc762891c21d7162f9cdcbe2ba4720b9cc8fe5bed87
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
# frozen_string_literal: true class Tynn # Serves static files (javascript files, images, stylesheets, etc). # # By default, these files are served from the <tt>./public</tt> folder. # A different location can be specified through the <tt>:root</tt> option. # # Under the hood, it uses the Rack::Static middleware. # Thus, supports all the options available by the middleware. # # require "tynn" # require "tynn/static" # # Tynn.plugin(Tynn::Static, ["/js", "/css"]) # Tynn.plugin(Tynn::Static, ["/js", "/css"], root: "assets") # Tynn.plugin(Tynn::Static, ["/js", "/css"], index: "index.html") # # For more information on the supported options, please see # Rack::Static[http://www.rubydoc.info/gems/rack/Rack/Static]. # module Static def self.setup(app, urls, opts = {}) # :nodoc: options = opts.dup options[:urls] ||= urls options[:root] ||= File.expand_path("public", Dir.pwd) app.use(Rack::Static, options) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tynn-2.0.0.beta1 | lib/tynn/static.rb |
tynn-2.0.0.alpha | lib/tynn/static.rb |