Sha256: 0172aad553d01049d33106bd85d50b929684c6d5237f6e2f0335990d3f9f80f5
Contents?: true
Size: 825 Bytes
Versions: 4
Compression:
Stored size: 825 Bytes
Contents
# Relative Assets extension class Middleman::Extensions::RelativeAssets < ::Middleman::Extension def initialize(app, options_hash={}, &block) super # After compass is setup, make it use the registered cache buster app.compass_config do |config| config.relative_assets = true end if app.respond_to?(:compass_config) end helpers do # asset_url override for relative assets # @param [String] path # @param [String] prefix # @return [String] def asset_url(path, prefix='') path = super(path, prefix) if path.include?('//') || path.start_with?('data:') || !current_resource path else current_dir = Pathname('/' + current_resource.destination_path) Pathname(path).relative_path_from(current_dir.dirname).to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems