view_component-contrib

Services & Skills

Share on

The goal of this project is to share common ViewComponent patterns and practices which we found useful while working on different projects (and which haven’t been or couldn’t be proposed to the upstream).

All extensions and patches are packed into a view_component-contrib meta-gem. So, to use them add to your Gemfile:

gem "view_component-contrib"

The easiest way to start using view_component-contrib extensions and patterns is to run an interactive generator (a custom Rails template. All you need to do is to run:

rails app:template LOCATION="https://railsbytes.com/script/zJosO5"

The command above:

  • Installs view_component-contrib gem.
  • Configure view_component paths.
  • Adds ApplicationViewComponent and ApplicationViewComponentPreview classes.
  • Configures testing framework (RSpec or Minitest).
  • Adds required JS/CSS configuration.
  • Adds a custom generator to create components.

The custom generator would allow you to create all the required component files in a single command:

bundle exec rails g view_component Example

# see all available options
bundle exec rails g view_component -h

Learn more in the README!

Author

Further reading

In the same orbit

Explore more open source projects

Contact us

We’d love to hear from you! We’re not really all that evil, and we love discussing potential projects, intriguing ideas, and new opportunities. Complete the form below or drop us a line at surrender@evilmartians.com.

Martians at a glance
16
years in business

A product development consultancy that works with startups and established businesses, while also creating open source-based products and services