Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
florentferry committed Dec 7, 2017
1 parent b3d426e commit a2df929
Showing 1 changed file with 42 additions and 16 deletions.
58 changes: 42 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,64 @@
# Komponent

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/komponent`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'komponent'
```

And then execute:
Modify your webpacker config to:

```
# config/webpacker.yml
source_path: frontend
```

$ bundle
## Usage

Or install it yourself as:
Generate new component with `component` generator:

$ gem install komponent
`rails generate component button`

## Usage
And use it in your views with helper. You can pass `locals`, or `block` to component helper.

TODO: Write usage instructions here
`= component('button')`

## Development
Locals passed in to component are accessible as instance variables.

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
```
= component('button', color: :red)
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
.button
= @color
```

You can define custom helpers in `ButtonComponent`:

```
class ButtonComponent
def bar
"foo"
end
end
.button
= bar
```

You can set properties in `ButtonComponent` too:

```
class ButtonComponent
property :foo, default: "bar", required: true
end
.button
= @foo
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/komponent.
Bug reports and pull requests are welcome on GitHub at https://github.com/ouvrages/komponent.

## License

Expand Down

0 comments on commit a2df929

Please sign in to comment.