Sha256: 60e708d575935af402d5130d18b804e95911c09f4a8b1e9a1dd1fa7a29b81db3
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
# 3rd-party require "sprockets" # internal require "jekyll/assets_plugin/asset_file" require "jekyll/assets_plugin/liquid_processor" module Jekyll module AssetsPlugin class Environment < Sprockets::Environment class AssetNotFound < StandardError def initialize path super "Couldn't find file '#{path}'" end end autoload :ContextPatch, "jekyll/assets_plugin/environment/context_patch" 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 register_preprocessor "text/css", LiquidProcessor register_preprocessor "application/javascript", LiquidProcessor # bind jekyll and Sprockets context together context_class.instance_variable_set :@site, @site context_class.send :include, ContextPatch end def find_asset path, *args super or raise AssetNotFound, path end def index super.tap do |index| index.instance_eval do def find_asset path, options = {} site = @environment.site asset = super bundle = options[:bundle] if asset and bundle and not site.static_files.include? asset site.static_files << AssetFile.new(site, asset) end asset end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-0.3.2 | lib/jekyll/assets_plugin/environment.rb |
jekyll-assets-0.3.1 | lib/jekyll/assets_plugin/environment.rb |