class Jekyll::Tags::EmbedSvgs
Public Class Methods
new(tag_name, markup, tokens)
click to toggle source
Calls superclass method
# File lib/esvg/jekyll_hooks.rb, line 25 def initialize(tag_name, markup, tokens) super @markup = markup.gsub(/["']/,'').split(/,\s*/) end
Public Instance Methods
render(context)
click to toggle source
Calls superclass method
# File lib/esvg/jekyll_hooks.rb, line 30 def render(context) super if Jekyll.env == 'production' config = context.registers[:site].config dest = config["destination"] url = Jekyll.esvg.config[:build].sub(dest, '') root_url = File.join config["baseurl"], url Esvg.build_paths(@markup).map { |path| %Q{<script src="#{File.join(root_url, path)}" async="true"></script>} }.join("\n") else Jekyll.esvg_embedded = true Esvg.embed() end end