Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heyvito/lucide-rails

Rails Helper for Lucide Icons
https://github.com/heyvito/lucide-rails

lucide-icon rails ruby

Last synced: about 2 months ago
JSON representation

Rails Helper for Lucide Icons

Awesome Lists containing this project

README

        

# lucide-rails

`lucide-rails` provides a view helper for using [Lucide icons](https://lucide.dev)
on Rails applications

## Installation

Install the gem and add to the application's Gemfile by executing:
```
$ bundle add lucide-rails
```

If bundler is not being used to manage dependencies, install the gem by executing:

```
$ gem install lucide-rails
```

## Usage

### Quickstart

The gem default options should be enough for most applications. Simply add it to
your `Gemfile`, and, in any view:

```erb
<%= lucide_icon('accessibility') %>
```

Which renders:

```html

```

### Providing Extra Attributes to a Single Icon

To provide extra attributes to a single SVG, pass them through the helper:

```erb
<%= lucide_icon('accessibility', 'extra-attr' => 'test') %>
```

Which yields the following HTML:

```html

```

### Providing Extra Attributes to All Icons

In case an application needs to add an extra attribute on every icon output by
this library, create a new initializer, and use `LucideRails.default_options=`:

```ruby
# config/initializers/lucide_rails.rb
LucideRails.default_options = LucideRails.default_options.merge(
'class' => 'lucide-icon',
'some-extra-attr' => 'some-other-value',
)
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run
`bundle exec rspec` to run the tests. You can also run `bundle exec bin/console`
for an interactive prompt that will allow you to experiment.

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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).

### Updating Bundled Icons

To sync the library with the official icon repository, and regenerate all files
from `icons/`, use `bundle exec bin/fetch-icons`.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/heyvito/lucide-rails.
This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the [code of conduct](https://github.com/heyvito/lucide-rails/blob/master/CODE_OF_CONDUCT.md).

## Code of Conduct

Everyone interacting in the Lucide::Rails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/heyvito/lucide-rails/blob/master/CODE_OF_CONDUCT.md).

## License

```
The MIT License (MIT)

Copyright (c) 2022-2024 Vito Sartori

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

```