{"id":15288781,"url":"https://github.com/slavikdev/roll-amp","last_synced_at":"2026-02-04T07:34:45.135Z","repository":{"id":56892583,"uuid":"85612874","full_name":"slavikdev/roll-amp","owner":"slavikdev","description":"AMP in Rails apps","archived":false,"fork":false,"pushed_at":"2017-03-25T19:59:23.000Z","size":74,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T15:32:27.236Z","etag":null,"topics":["amp","amp-html","api","gem","library","rails","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"https://github.com/roll-rails","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slavikdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-20T18:37:55.000Z","updated_at":"2019-05-28T13:24:41.000Z","dependencies_parsed_at":"2022-08-21T01:20:56.474Z","dependency_job_id":null,"html_url":"https://github.com/slavikdev/roll-amp","commit_stats":null,"previous_names":["roll-rails/roll-amp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/slavikdev/roll-amp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavikdev%2Froll-amp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavikdev%2Froll-amp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavikdev%2Froll-amp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavikdev%2Froll-amp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavikdev","download_url":"https://codeload.github.com/slavikdev/roll-amp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavikdev%2Froll-amp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265108514,"owners_count":23712466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amp","amp-html","api","gem","library","rails","ruby","ruby-gem"],"created_at":"2024-09-30T15:53:09.914Z","updated_at":"2026-02-04T07:34:45.085Z","avatar_url":"https://github.com/slavikdev.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AMP in Rails apps\nUtilities to simplify Accelerated Mobile Pages (AMP) implementation in Rails apps.\n\n[![Travis Build Status](https://travis-ci.org/roll-rails/roll-amp.svg?branch=master)](https://travis-ci.org/roll-rails/roll-amp)\n[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/4i4t22ggmecnkg6k?svg=true)](https://ci.appveyor.com/project/slavikdev/roll-amp)\n[![Test Coverage](https://codeclimate.com/github/roll-rails/roll-amp/badges/coverage.svg)](https://codeclimate.com/github/roll-rails/roll-amp/coverage)\n[![Code Climate](https://codeclimate.com/github/roll-rails/roll-amp/badges/gpa.svg)](https://codeclimate.com/github/roll-rails/roll-amp)\n[![Issue Count](https://codeclimate.com/github/roll-rails/roll-amp/badges/issue_count.svg)](https://codeclimate.com/github/roll-rails/roll-amp)\n\n## Features\nImplemented:\n* Tag to include AMP boilerplate CSS.\n* Tag to include AMP base JS.\n* Tag to include custom CSS.\n* Google Analytics integration.\n\nTodo:\n* AMP validation via Ruby tests.\n* ...\n\n## Platforms\nMinimum supported MRI version is `2.2.6`. JRuby is not supported.\nThe gem should work on Mac, Linux and Windows, however testing\nis limited as follows:\n* Mac OS X (development machine)\n  * `2.4.0`\n* Windows (via appveyor)\n  * `2.3.3`\n  * `2.2.6`\n* Ubuntu (via travis-ci)\n  * `2.4.0`\n  * `2.3.3`\n  * `2.2.6`\n  * `Head`\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'roll-amp'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install roll-amp\n\n## Usage\n* [Documentation on RubyDoc](http://www.rubydoc.info/gems/roll-amp/)\n* [How to setup AMP layout for Rails app pages](https://github.com/roll-rails/roll-amp/wiki/How-to-setup-AMP-layout-for-Rails-app-pages)\n\n### Include main JS\n```\n\u003c%= amp_js %\u003e\n```\nIncludes `https://cdn.ampproject.org/v0.js` script at a place where the `amp_js`\ntag was specified.\nThis tag is required for AMP.\n\n### Include boilerplate CSS\n```\n\u003c%= amp_boilerplate %\u003e\n```\nIncludes basic CSS suggested at https://www.ampproject.org/docs/get_started/create/basic_markup\n\n### Include custom CSS\n1. Create CSS (SASS, SCSS) file under `app/stylesheets` of your Rails app.\nFor example `app/stylesheets/amp/application.scss`.\n2. Add the following line to your AMP layout:\n```\n\u003c%= amp_custom_style('amp/application') %\u003e\n```\nWhen `amp/application` is available in the assets pipeline,\nits content will be loaded from there. Otherwise such file will be searched in\nthe `public` directory.\nUsually it’s sufficient to create CSS file and Rails will handle the rest.\n*Please note, AMP sets 50K limit on CSS size. If you include larger stylesheet\nyour pages won’t be valid.*\n\n### Google Analytics\n1. Insert the following tag *before* `amp_js`:\n```\n\u003c%= amp_analytics_js %\u003e\n```\n2. Add analytics configuration to the *body*:\n```\n\u003c%=\n  amp_google_analytics(\n    'UA-00000-1',\n    {\n      trackPageview: {\n        on: 'visible',\n        request: 'pageview'\n      }\n    }\n  )\n%\u003e\n```\nFirst parameter is Google Analytics account ID.\nSecond parameter defines triggers. Please see [Adding Analytics to your AMP pages](https://developers.google.com/analytics/devguides/collection/amp-analytics/)\nto learn about triggers. The example above shows the most common configuration.\n\n\n### Layout example\n```html\n\u003c!doctype html\u003e\n\u003chtml ⚡\u003e\n  \u003chead\u003e\n    \u003c%= amp_analytics_js %\u003e\n    \u003c%= amp_js %\u003e\n    \u003c%= csrf_meta_tags %\u003e\n    \u003c%= amp_boilerplate %\u003e\n    \u003c%= amp_custom_style('amp/application') %\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003c%=\n      amp_google_analytics(\n        'UA-00000-1',\n        {\n          trackPageview: {\n            on: 'visible',\n            request: 'pageview'\n          }\n        }\n      )\n    %\u003e\n    \u003c%= yield %\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nThen, run `rake spec` to run the tests. You can also run `bin/console`\nfor an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\nTo release a new version, update the version number in `version.rb`,\nand then run `bundle exec rake release`, which will create a git tag for\nthe version, push git commits and tags, and push the `.gem`\nfile to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub\nat https://github.com/roll-rails/roll-amp. This project is intended to be\na safe, welcoming space for collaboration, and contributors are expected\nto adhere to the [Contributor Covenant](http://contributor-covenant.org)\ncode of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavikdev%2Froll-amp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslavikdev%2Froll-amp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavikdev%2Froll-amp/lists"}