Sha256: a7b6355cbfdc2bd9fdd92206dbe71f6903b4c52370f501fbf077b042b99ba94e
Contents?: true
Size: 1020 Bytes
Versions: 5
Compression:
Stored size: 1020 Bytes
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] (@site.assets_config.debug ? asset.to_a : [asset]).map{ |a| template % AssetPath.new(a).to_s }.join("\n") end end end end
Version data entries
5 entries across 5 versions & 1 rubygems