{"id":19575530,"url":"https://github.com/sistrall/amcss-rails","last_synced_at":"2025-10-11T22:02:06.491Z","repository":{"id":33895572,"uuid":"37609202","full_name":"sistrall/amcss-rails","owner":"sistrall","description":"Use AMCSS in Rails projects","archived":false,"fork":false,"pushed_at":"2015-06-19T07:59:03.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-09T04:20:22.142Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sistrall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-17T17:13:14.000Z","updated_at":"2015-06-17T17:14:07.000Z","dependencies_parsed_at":"2022-08-17T20:15:30.864Z","dependency_job_id":null,"html_url":"https://github.com/sistrall/amcss-rails","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sistrall%2Famcss-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sistrall%2Famcss-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sistrall%2Famcss-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sistrall%2Famcss-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sistrall","download_url":"https://codeload.github.com/sistrall/amcss-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240842022,"owners_count":19866501,"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":[],"created_at":"2024-11-11T06:48:37.737Z","updated_at":"2025-10-11T22:02:01.471Z","avatar_url":"https://github.com/sistrall.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amcss::Rails\n\namcss-rails makes [amcss](https://github.com/sistrall/amcss) available in Rails (don't know amcss? Take a look at  [README](https://github.com/sistrall/amcss/blob/master/README.md)).\n\n[![Build Status](https://travis-ci.org/sistrall/amcss-rails.svg)](https://travis-ci.org/sistrall/amcss-rails)\n\nShortly: you write this...\n\n```haml\n= am(:box) do |b|\n  = b.am(:header) do\n    Header\n  = b.am(:content) do\n    Body\n```\n\n...and get this:\n\n```html\n\u003cdiv data-am-box\u003e\n  \u003cdiv data-am-box__header\u003eHeader\u003c/div\u003e\n  \u003cdiv data-am-box__content\u003eContent\u003c/div\u003e\n\u003c/div\u003e\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'amcss-rails'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install amcss-rails\n\n## Usage\n\namcss-rails allows you to use helper in your views like this:\n\n```erb\n\u003c%= am('Calendar', variation: 'flat') do %\u003e\n  \u003cp\u003eHi, I'm a calendar\u003c/p\u003e\n\u003c% end %\u003e\n```\n\nWhat you'll get is a `div` with AMCSS attribute:\n\n```html\n\u003cdiv am-Calendar=\"flat\"\u003e\n  \u003cp\u003eHi, I'm a calendar\u003c/p\u003e\n\u003c/div\u003e\n```\n\nIt seems nothing, but the interesting part comes when you try to nest blocks and add a little bit of configuration. Take a look.\n\nCreate 2 initializer files:\n\n```ruby\n# In config/initializers/amcss.rb\nAmcss.configure do |configuration|\n  configuration.prefix = :data\nend\n```\n\n```ruby\n# In config/initializers/amcss-rails.rb\nAmcss::Rails::Engine.configure do |engine|\n  engine.config.amcss.style = :bem\n  engine.config.amcss.block_element_separator = '__'\nend\n```\n\nThan write this code in your template:\n\n```erb\n\u003c%= am(:calendar, variation: 'flat') do |calendar| %\u003e\n  \u003c%= calendar.am(:header, variation: 'padded') do %\u003e\n    Header\n  \u003c% end %\u003e\n  \u003c%= calendar.am(:body) do %\u003e\n    Body\n  \u003c% end %\u003e\n\u003c% end %\u003e\n```\n\nThis is what you get:\n\n```html\n\u003cdiv data-am-calendar=\"flat\"\u003e\n  \u003cdiv data-am-calendar__header=\"padded\"\u003e\u003c/div\u003e\n  \u003cdiv data-am-calendar__body\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\nEven easier to read if you are a HAML fan:\n\n```haml\n= am(:calendar, variation: 'flat') do |calendar|\n  = calendar.am(:header, variation: 'padded') do\n    Header\n  = calendar.am(:body) do\n    Body\n```\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/amcss-rails/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsistrall%2Famcss-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsistrall%2Famcss-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsistrall%2Famcss-rails/lists"}