Sha256: 4c70fe6c5bd589403b0cb6057525dd88efdcac06a57c2f7028ad6e7459025b2a
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Jekyll module AssetsPlugin class Renderer STYLESHEET = '<link rel="stylesheet" href="%s">' JAVASCRIPT = '<script src="%s"></script>' IMAGE = '<img src="%s">' 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? render_tag JAVASCRIPT end def render_stylesheet @path << ".css" if File.extname(@path).empty? render_tag STYLESHEET end def render_image render_tag IMAGE end protected def render_tag(template) asset = @site.assets[@path] tags = (@site.assets_config.debug ? asset.to_a : [asset]).map do |a| sprintf template, AssetPath.new(a).to_s end tags.join "\n" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-0.7.7 | lib/jekyll/assets_plugin/renderer.rb |