Sha256: 682943e8c149e0f340221dc712cefa2ba60a5a9d7ed9369f7ee12a0441833a59
Contents?: true
Size: 1.03 KB
Versions: 12
Compression:
Stored size: 1.03 KB
Contents
# Extension namespace module Middleman module Extensions # Relative Assets extension module RelativeAssets # Setup extension class << self # Once registered def registered(app) # Tell compass to use relative assets app.compass_config do |config| config.relative_assets = true end # Include instance methods app.send :include, InstanceMethods end alias :included :registered end # Relative Assets instance method module InstanceMethods # 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 else current_dir = Pathname('/' + current_resource.destination_path) Pathname(path).relative_path_from(current_dir.dirname) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems