Class: Jekyll::Assets::HTML::JS

Inherits:
Jekyll::Assets::HTML show all
Defined in:
lib/jekyll/assets/plugins/html/js.rb

Instance Attribute Summary

Attributes inherited from Jekyll::Assets::HTML

#doc

Attributes inherited from Extensible

#args, #asset, #ctx, #env, #jekyll

Instance Method Summary collapse

Methods inherited from Jekyll::Assets::HTML

build, #initialize, make_doc, skips, wants_xml?

Methods inherited from Extensible

for?, for_args?, for_type?, inherited, #initialize, internal!, internal?, requirements

Constructor Details

This class inherits a constructor from Jekyll::Assets::HTML

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jekyll/assets/plugins/html/js.rb', line 15

def run
  if @asset.is_a?(Url) && @args[:inline]
    raise Tag::MixedArg, "@external", "@inline"

  else
    Nokogiri::HTML::Builder.with(@doc) do |d|
      attr = @args.to_h(html: true, skip: HTML.skips)
      d.script(@asset.to_s, attr) if @args[:inline]
      d.script(attr) unless @args[:inline]
    end
  end
end