# view_component-contrib

> A collection of extensions and developer tools for ViewComponent.

- URL: https://evilmartians.com/opensource/view-component-contrib
- GitHub: https://github.com/palkan/view_component-contrib
- Authors: Vladimir Dementyev

---

view_component-contrib is a collection of extensions and developer tools for ViewComponent.

The goal of this project is to share common [ViewComponent](https://github.com/github/view_component) 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:

```ruby
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:

```sh
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:

```sh
bundle exec rails g view_component Example

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

Learn more in the [README](https://github.com/palkan/view_component-contrib/blob/master/README.md)!
