houdini/lib/include_asset.rb

18 lines
451 B
Ruby

module IncludeAsset
# These are custom asset include functions for use in views that cache-bust using the current git version
def self.js(path)
%Q(<script src="#{path}?v=#{asset_version}" type="text/javascript"></script>).html_safe
end
def self.css(path)
%Q(<link rel='stylesheet' type='text/css' media='all' href="#{path}?v=#{asset_version}">).html_safe
end
private
def self.asset_version
ENV['ASSET_VERSION']
end
end