Sha256: fc7ce738f759d45f6df5e827a3d574c7b790d1414738b498699039a19fe31305

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 Bytes

Contents

# Frozen-string-literal: true
# Copyright: 2012 - 2017 - MIT License
# Encoding: utf-8

require "jekyll/assets"
require "nokogiri"

module Jekyll
  module Assets
    class HTML
      class JS < HTML
        content_types "application/javascript",
          "text/javascript"

        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
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-assets-3.0.3 lib/jekyll/assets/plugins/html/js.rb
jekyll-assets-3.0.2 lib/jekyll/assets/plugins/html/js.rb
jekyll-assets-3.0.1 lib/jekyll/assets/plugins/html/js.rb
jekyll-assets-3.0.0 lib/jekyll/assets/plugins/html/js.rb