rails_picture

Simple picture_tag helper, which can show various image formats based on browser support

Report Bug / Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License

About The Project

Provide a new helper method to Rails views - picture_tag
It generates a <picture> HTML tag and within it places HTML tag as <img> and any other available image formats as <source> tags.

Internally it uses Rails built-in method image_tag.

Installation

Add this line to your application's Gemfile:


gem 'rails_picture'

And then execute in terminal:

bundle install

Usage

  1. Put multiple same-named images with different file formats into app/assets/images/

  2. Place following code into any Rails view. It takes the same options as Rails built in image_tag :

picture_tag(filename, **options)

Note - do not input file extension in filename

Roadmap

See the TODO for status of current development.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development

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

<!-- LICENSE -->

License

The gem is available as open source under the terms of the MIT License.

Conduct

Project Link: https://github.com/OskarsEzerins/rails_picture

Everyone interacting in the rails_picture project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.