Sha256: 61640f1964abe55cb44b8735049cf9c3097200f202639b007da6352b94a11b2f
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'sinatra/bundles/bundle' require 'rainpress' module Sinatra module Bundles # Bundle for stylesheets class StylesheetBundle < Bundle # Generate the HTML tag for the stylesheet # # @param [String] name The name of a bundle # @return [String] The HTML that can be inserted into the doc def to_html(name, media = nil) media ||= :all media = media.join(", ") if media.is_a? Array "<link type='text/css' href='/stylesheets/bundles/#{name}.css#{@app.stamp_bundles ? "?#{stamp}" : ''}' rel='stylesheet' media='#{media}' />" end protected # The root of these bundles, for path purposes def root File.join(@app.public, 'stylesheets') end # Compress CSS # # @param [String] css The CSS to compress # @return [String] Compressed CSS def compress(css) Rainpress.compress(css) end # Get the path of the file on disk # # @param [String] filename The name of sheet, # assumed to be in the public directory, under 'stylesheets' # @return [String] The full path to the file def path(filename) File.join(@app.public, 'stylesheets', "#{filename}.css") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-bundles-0.2.0 | lib/sinatra/bundles/stylesheet_bundle.rb |