Sha256: b56e1eb7e3ee1895397fb2984a386c1a364ccc6a633fbad9d001a76393098c53

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

# encoding: utf-8

require 'rack/classy_assets'

module Sinatra
  module ClassyAssets
    module Helpers
      def stylesheet_tag(sources, options = {})
        options = { media: 'screen' }.merge(options)
        ::ClassyAssets.asset_tag_from(sources, 'css') do |asset_url|
          %Q{<link href="#{asset_url}" media="#{options[:media]}" rel="stylesheet">}
        end
      end
      
      def javascript_tag(sources)
        ::ClassyAssets.asset_tag_from(sources, 'js') do |asset_url|
          %Q{<script src="#{asset_url}"></script>}
        end
      end
    end
    
    def self.registered(app)
      app.use ::Rack::ClassyAssets
      app.helpers Helpers
    end
  end
  register ClassyAssets
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
classy_assets-0.4.1 lib/sinatra/classy_assets.rb
classy_assets-0.4.0 lib/sinatra/classy_assets.rb