Sha256: 451cbecf1e5f011258ba24d275a0658922e6e863594e6b9b8fcd38133231393d

Contents?: true

Size: 873 Bytes

Versions: 5

Compression:

Stored size: 873 Bytes

Contents

# 3rd-party
require "sprockets"


module Jekyll
  module AssetsPlugin
    class Environment < Sprockets::Environment

      class AssetNotFound < StandardError
        def initialize path
          super "Couldn't find file '#{path}'"
        end
      end


      attr_reader :site


      def initialize site
        super site.source

        @site = site

        # append asset paths
        @site.assets_config.sources.each { |p| append_path p }

        self.js_compressor   = @site.assets_config.js_compressor
        self.css_compressor  = @site.assets_config.css_compressor

        # bind jekyll and Sprockets context together
        context_class.instance_variable_set :@site, @site

        context_class.send :include, Patches::ContextPatch
      end


      def find_asset path, *args
        super or raise AssetNotFound, path
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-assets-0.4.3 lib/jekyll/assets_plugin/environment.rb
jekyll-assets-0.5.1 lib/jekyll/assets_plugin/environment.rb
jekyll-assets-0.5.0 lib/jekyll/assets_plugin/environment.rb
jekyll-assets-0.4.2 lib/jekyll/assets_plugin/environment.rb
jekyll-assets-0.4.1 lib/jekyll/assets_plugin/environment.rb