Skip to content

Instantly share code, notes, and snippets.

@jamesdarvell
jamesdarvell / data_uri_inlining.rb
Created February 6, 2015 17:55
A middleman app helper method for creating a base 64 encoded uri for an asset (to inline it).
module DataUriInlining
def asset_data_uri(name)
asset = sprockets.find_asset(name)
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "")
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
end
end
/*
Shameless port of a shameless port
@defunkt => @janl => @aq
See http://github.com/defunkt/mustache for more info.
*/
;(function($) {
/*!