https://github.com/unasuke/middleman-img_loading_attribute
https://github.com/unasuke/middleman-img_loading_attribute
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/unasuke/middleman-img_loading_attribute
- Owner: unasuke
- License: mit
- Created: 2019-11-07T08:45:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-28T14:18:19.000Z (over 4 years ago)
- Last Synced: 2025-03-25T13:01:50.285Z (about 1 year ago)
- Language: Ruby
- Homepage: https://rubygems.org/gems/middleman-img_loading_attribute
- Size: 30.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Middleman::ImgLoadingAttribute
[](https://github.com/unasuke/middleman-img_loading_attribute/actions)
[](https://github.com/unasuke/middleman-img_loading_attribute/actions)
[](https://ci.appveyor.com/project/unasuke/middleman-img-loading-attribute/branch/master)
[](https://circleci.com/gh/unasuke/middleman-img_loading_attribute/tree/master)


Specify "loading" attribute value to generated HTML from Middleman
You can choose "lazy", "auto", and "eager" to loading attribite by configuration.
## Installation
Add this line to your Middleman project's Gemfile:
```ruby
gem 'middleman-img_loading_attribute'
```
And then execute:
```shell
$ bundle
```
## Usage
Activate `img_loading_attribute` in your `config.rb`.
### loading="lazy"
```ruby
activate :img_loading_attribute do |c|
c.loading = 'lazy'
end
```
### loading="auto"
```ruby
activate :img_loading_attribute do |c|
c.loading = 'auto'
end
# If no configuration specified, choose "auto" as default value
activate :img_loading_attribute
```
### loading="eager"
```ruby
activate :img_loading_attribute do |c|
c.loading = 'eager'
end
```
## Development
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in gemspec, 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).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/unasuke/middleman-img_loading_attribute. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Middleman::ImgLoadingAttribute project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/unasuke/middleman-img_loading_attribute/blob/master/CODE_OF_CONDUCT.md).