Sha256: ccffbe70090126d9b6b2404b57d4c9ec415783289185b349df39aa3a919fc29d

Contents?: true

Size: 793 Bytes

Versions: 12

Compression:

Stored size: 793 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

      def asset_url(source)
        ::ClassyAssets.asset_url_for(source)
      end
    end
    
    def self.registered(app)
      app.use ::Rack::ClassyAssets
      app.helpers Helpers
    end
  end
  register ClassyAssets
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
classy_assets-0.8.0 lib/sinatra/classy_assets.rb
classy_assets-0.7.2 lib/sinatra/classy_assets.rb
classy_assets-0.7.1 lib/sinatra/classy_assets.rb
classy_assets-0.7.0 lib/sinatra/classy_assets.rb
classy_assets-0.6.3 lib/sinatra/classy_assets.rb
classy_assets-0.6.2 lib/sinatra/classy_assets.rb
classy_assets-0.6.1 lib/sinatra/classy_assets.rb
classy_assets-0.6.0 lib/sinatra/classy_assets.rb
classy_assets-0.5.0 lib/sinatra/classy_assets.rb
classy_assets-0.4.5 lib/sinatra/classy_assets.rb
classy_assets-0.4.4 lib/sinatra/classy_assets.rb
classy_assets-0.4.3 lib/sinatra/classy_assets.rb