Skip to content

neopoly/tagfiles

Repository files navigation

Tagfiles

Travis Gem Version Code Climate Test Coverage Inline docs

Gem | Source | Documentation

Tagfiles provides the tagfile helper for Rails.

Installation

Add this line to your application's Gemfile:

gem 'tagfiles'

And then execute:

$ bundle

Basic Usage

Tagfile: app/views/tagfiles/_box.html.haml

.box
  %h2= title
  %p= yield

HAML file using box tagfile: app/views/admin/page/index.html.haml

= tf :box, title: "Box title"
  Some box content

See examples/ and specs for more examples.

Lookup order

Rendering the box tagfile from the example above will trigger with following lookups:

  • app/views/admin/page/tagfiles/_box.html.erb
  • app/views/admin/tagfiles/_box.html.erb
  • app/views/tagfiles/_box.html.erb

Rails support

Following Rails versions are supported:

  • 6.0
  • 5.2
  • 4.2

Feel free to test earlier Rails versions. Feedback is welcome!

Ruby support

Ruby versions from 2.4.9 to 2.7.0 are supported.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request