Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module AssetsHelper
def inline_file(path)
if assets = Rails.application.assets
asset = assets.find_asset(path)
return '' unless asset
asset.source
else
File.read(File.join(Rails.root, 'public', asset_path(path)))
end
end
def inline_css(path)
"<style>#{inline_file path}</style>".html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.