Sha256: 65329d916f1147da2e5effae1b2c58930142e6b74f95308f53720d43c12e72d2
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
# Frozen-string-literal: true # Copyright: 2012 - 2017 - MIT License # Encoding: utf-8 require "jekyll/assets" module Jekyll module Assets class Default class JS < Default content_types "text/javascript" content_types "application/javascript" static type: "text/javascript" def set_src return @args[:src] = @asset.url if @asset.is_a?(Url) @args[:src] = @env.prefix_url(@asset .digest_path) end def set_integrity return unless integrity? @args[:integrity] = @asset.integrity unless @args.key?(:crossorigin) @args[:crossorigin] = "anonymous" end end # -- def integrity? config[:integrity] && !@asset.is_a?(Url) && !@args.key?(:integrity) end end end end end # -- Jekyll::Assets::Hook.register :config, :before_merge do |c| c.deep_merge!({ defaults: { js: { integrity: Jekyll.production?, }, }, }) end
Version data entries
4 entries across 4 versions & 1 rubygems