Sha256: cd08ec97781e305baddfcfd55c63b502630396533ad222a3d43c699f7053134a

Contents?: true

Size: 716 Bytes

Versions: 2

Compression:

Stored size: 716 Bytes

Contents

module Jekyll
  module AssetsPlugin
    class Renderer

      STYLESHEET = '<link rel="stylesheet" href="%s">'
      JAVASCRIPT = '<script src="%s"></script>'


      def initialize context, logical_path
        @site = context.registers[:site]
        @path = logical_path.strip
      end


      def render_asset
        @site.assets[@path].to_s
      end


      def render_asset_path
        @site.asset_path @path
      end


      def render_javascript
        @path << ".js" if File.extname(@path).empty?

        JAVASCRIPT % render_asset_path
      end


      def render_stylesheet
        @path << ".css" if File.extname(@path).empty?

        STYLESHEET % render_asset_path
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-assets-0.6.1 lib/jekyll/assets_plugin/renderer.rb
jekyll-assets-0.6.0 lib/jekyll/assets_plugin/renderer.rb