Module: Roll::Amp::Helpers::Tags
- Defined in:
- lib/roll/amp/helpers/tags.rb
Overview
Implements tags to be used in Rails templates.
Instance Method Summary collapse
-
#amp_analytics_js ⇒ String
Renders script tag with link to AMP analytics JS.
-
#amp_boilerplate ⇒ String
Renders AMP boilerplate stylesheet.
-
#amp_custom_style(file_name) ⇒ String
Renders custom stylesheet.
-
#amp_google_analytics(account, triggers = {}) ⇒ String
Renders tags to connect Google Analytics.
-
#amp_js ⇒ String
Renders script tag with link to AMP main JS.
Instance Method Details
#amp_analytics_js ⇒ String
Renders script tag with link to AMP analytics JS.
36 37 38 |
# File 'lib/roll/amp/helpers/tags.rb', line 36 def amp_analytics_js Script::AnalyticsScriptTag.new.to_html end |
#amp_boilerplate ⇒ String
Renders AMP boilerplate stylesheet.
11 12 13 |
# File 'lib/roll/amp/helpers/tags.rb', line 11 def amp_boilerplate Style::BoilerplateStyleTagsSet.new.to_html end |
#amp_custom_style(file_name) ⇒ String
Renders custom stylesheet. content of the file specified.
18 19 20 21 22 23 24 25 26 |
# File 'lib/roll/amp/helpers/tags.rb', line 18 def amp_custom_style(file_name) Style::CustomStyleTag.new( Style::Stylesheet.new( ::Rails.root, ::Rails.application.assets, file_name ).read ).to_html end |
#amp_google_analytics(account, triggers = {}) ⇒ String
Renders tags to connect Google Analytics. which configures Google Analytics.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/roll/amp/helpers/tags.rb', line 43 def amp_google_analytics(account, triggers = {}) Html::GoogleAnalyticsTag.new( Script::JsonScriptTag.new({ vars: { account: account }, triggers: triggers }.to_json).to_html ).to_html end |