Sha256: fa44e1eabeac6ec053a3f2e7e5deb02aea21a31b6078bf30716ae03b458e893e

Contents?: true

Size: 686 Bytes

Versions: 2

Compression:

Stored size: 686 Bytes

Contents

module Kernel
  def has_javascript?
    require "execjs"
    if block_given?
      yield
    end
  rescue LoadError, ExecJS::RuntimeUnavailable
    Jekyll.logger.debug("ExecJS or JS Runtime not available." \
      " Skipping loading of library.")
  end

  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

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-assets-2.0.0.pre.beta4 lib/jekyll/assets/patches/kernel.rb
jekyll-assets-2.0.0.pre.beta3 lib/jekyll/assets/patches/kernel.rb