Module: Jekyll::AssetsPlugin::Patches::SitePatch
- Defined in:
- lib/jekyll/assets_plugin/patches/site_patch.rb
Class Method Summary collapse
Instance Method Summary collapse
- #__wrap_write ⇒ Object
- #asset_files ⇒ Object
- #asset_path(pathname, *args) ⇒ Object
- #assets ⇒ Object
- #assets_config ⇒ Object
- #bundle_asset!(asset) ⇒ Object
Class Method Details
.included(base) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 16 def self.included(base) base.class_eval do alias_method :__orig_write, :write alias_method :write, :__wrap_write end end |
Instance Method Details
#__wrap_write ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 53 def __wrap_write static_files.push(*asset_files).uniq! do |asset| case hash = asset.hash when Fixnum then hash else Digest::MD5.new.update(hash.to_s).hash end end __orig_write end |
#asset_files ⇒ Object
31 32 33 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 31 def asset_files @asset_files ||= [] end |
#asset_path(pathname, *args) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 35 def asset_path(pathname, *args) pathname, _, anchor = pathname.rpartition "#" if pathname["#"] pathname, _, query = pathname.rpartition "?" if pathname["?"] asset_path = AssetPath.new assets[pathname, *args] asset_path.anchor = anchor asset_path.query = query asset_path.to_s end |
#assets ⇒ Object
27 28 29 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 27 def assets @assets ||= Environment.new self end |
#assets_config ⇒ Object
23 24 25 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 23 def assets_config @assets_config ||= Configuration.new(self, config["assets"] || {}) end |
#bundle_asset!(asset) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/jekyll/assets_plugin/patches/site_patch.rb', line 46 def bundle_asset!(asset) return if asset_files.include? asset asset_files << asset asset.jekyll_assets.each { |path| bundle_asset! assets[path] } end |