Sha256: 9bf9e54216ea3f151cd279042ce3a2180fa24ea9bf499d0bc82de6a975418cad

Contents?: true

Size: 772 Bytes

Versions: 12

Compression:

Stored size: 772 Bytes

Contents

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

module Kernel
  def try_require(file)
    require file
    if block_given?
      yield
    end
  rescue LoadError
    return nil
  end

  # --------------------------------------------------------------------------

  def try_require_if_javascript(file)
    ["execjs", file].map(&method(:require))
    if block_given?
      yield
    end
  rescue LoadError, ExecJS::RuntimeUnavailable
    Jekyll.logger.debug("ExecJS, JS Runtime or `#{file}' not available." \
      " Skipping the loading of libraries.")
    return
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jekyll-assets-2.4.0 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.3.2 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.3.0 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.8 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.7 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.6 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.5 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.4 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.3 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.2 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.1 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.2.0 lib/jekyll/assets/patches/kernel.rb