2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-25 16:15:39 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
2018-03-25 17:30:42 +00:00
|
|
|
module IncludeAsset
|
|
|
|
# These are custom asset include functions for use in views that cache-bust using the current git version
|
|
|
|
|
|
|
|
def self.js(path)
|
2019-07-30 21:29:24 +00:00
|
|
|
%(<script src="#{path}?v=#{asset_version}" type="text/javascript"></script>).html_safe
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.css(path)
|
2019-07-30 21:29:24 +00:00
|
|
|
%(<link rel='stylesheet' type='text/css' media='all' href="#{path}?v=#{asset_version}">).html_safe
|
2018-03-25 17:30:42 +00:00
|
|
|
end
|
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
private
|
|
|
|
|
2018-03-25 17:30:42 +00:00
|
|
|
def self.asset_version
|
|
|
|
ENV['ASSET_VERSION']
|
|
|
|
end
|
|
|
|
end
|