Module: BranchableCDNAssets::Middleman::SassHelpers
- Defined in:
- lib/branchable_cdn_assets/middleman/helpers.rb
Instance Method Summary collapse
-
#application_context ⇒ Object
TODO: add a test that exercises this code.
- #cdn_asset_path(path, cdn = nil) ⇒ Object
- #cdn_asset_url(path, cdn = nil) ⇒ Object
Instance Method Details
#application_context ⇒ Object
TODO: add a test that exercises this code
75 76 77 78 79 80 81 82 |
# File 'lib/branchable_cdn_assets/middleman/helpers.rb', line 75 def application_context if .key?(:custom) [:custom][:middleman_context] || [:custom][:sprockets_context] elsif .key?(:sprockets) [:sprockets][:context] end end |
#cdn_asset_path(path, cdn = nil) ⇒ Object
67 68 69 70 71 |
# File 'lib/branchable_cdn_assets/middleman/helpers.rb', line 67 def cdn_asset_path( path, cdn=nil ) cdn = cdn.value if cdn.respond_to?(:value) # have to force cdn to a string if not nil file = application_context.cdn_asset_url( path.value, cdn ) ::Sass::Script::String.new file, :string end |
#cdn_asset_url(path, cdn = nil) ⇒ Object
63 64 65 |
# File 'lib/branchable_cdn_assets/middleman/helpers.rb', line 63 def cdn_asset_url( path, cdn=nil ) ::Sass::Script::String.new("url(#{cdn_asset_path(path, cdn)})") end |