{"id":19474624,"url":"https://github.com/tomasc/picture_tag","last_synced_at":"2025-10-04T16:12:46.205Z","repository":{"id":18649414,"uuid":"21856302","full_name":"tomasc/picture_tag","owner":"tomasc","description":"Rails helper for \u003cpicture\u003e tag integrated with Picturefill.","archived":false,"fork":false,"pushed_at":"2018-02-04T08:13:56.000Z","size":24,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-14T21:23:52.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomasc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-15T10:55:38.000Z","updated_at":"2021-03-15T08:14:12.000Z","dependencies_parsed_at":"2022-09-13T18:21:49.034Z","dependency_job_id":null,"html_url":"https://github.com/tomasc/picture_tag","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fpicture_tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fpicture_tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fpicture_tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fpicture_tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasc","download_url":"https://codeload.github.com/tomasc/picture_tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250272521,"owners_count":21403407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:25:53.593Z","updated_at":"2025-10-04T16:12:41.171Z","avatar_url":"https://github.com/tomasc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PictureTag\n\n[![Build Status](https://travis-ci.org/tomasc/picture_tag.svg)](https://travis-ci.org/tomasc/picture_tag) [![Gem Version](https://badge.fury.io/rb/picture_tag.svg)](http://badge.fury.io/rb/picture_tag) [![Coverage Status](https://img.shields.io/coveralls/tomasc/picture_tag.svg)](https://coveralls.io/r/tomasc/picture_tag)\n\nRails helper for `\u003cpicture\u003e` tag integrated with [Picturefill](http://scottjehl.github.io/picturefill/).\n\n## Installation\n\nAdd this to your application's Gemfile:\n\n```ruby\n  gem 'picture_tag'\n```\n\nAnd then execute:\n\n```sh\n$ bundle\n```\n\nOr install it yourself as:\n\n```sh\n$ gem install picture_tag\n```\n\nIn case you would like to add a picture polyfill:\n\n```ruby\n  source 'https://rails-assets.org' do\n    gem 'rails-assets-picturefill'\n  end\n```\n\nAnd add to your `application.js`:\n\n```JS\n//= require picture_tag\n```\n\n## Usage\n\n```Slim\n= picture_tag '/images/fallback.jpg', image: { alt: 'Your smart alt attribute' } do\n  = source_tag srcset: '/images/large.jpg', media: '(min-width: 2000px)', sizes: '100vw'\n  = source_tag srcset: '/images/large_retina.jpg 2x', media: '(min-width: 2000px)', sizes: '100vw'\n  = source_tag srcset: '/images/medium.jpg', media: '(min-width: 1000px)', sizes: '100vw'\n  = source_tag srcset: '/images/medium_retina.jpg 2x', media: '(min-width: 1000px)', sizes: '100vw'\n  = source_tag srcset: '/images/small.jpg', sizes: '100vw'\n  = source_tag srcset: '/images/small_retina.jpg 2x', sizes: '100vw'\n```\n\nproduces\n\n```HTML\n\u003cpicture\u003e\n  \u003csource srcset=\"/images/large.jpg\" media=\"(min-width: 2000px)\" sizes=\"100vw\"\u003e\n  \u003csource srcset=\"/images/large_retina.jpg 2x\" media=\"(min-width: 2000px)\" sizes=\"100vw\"\u003e\n  \u003csource srcset=\"/images/medium.jpg\" media=\"(min-width: 1000px)\" sizes=\"100vw\" \u003e\n  \u003csource srcset=\"/images/medium_retina.jpg 2x\" media=\"(min-width: 1000px)\" sizes=\"100vw\" \u003e\n  \u003csource srcset=\"/images/small.jpg\" sizes=\"100vw\"\u003e\n  \u003csource srcset=\"/images/small_retina.jpg 2x\" sizes=\"100vw\"\u003e\n  \u003cimg alt=\"Your smart alt attribute\" srcset=\"/images/fallback.jpg\"\u003e\n\u003c/picture\u003e\n```\n\nNote that the mandatory `img` tag is automatically generated based on the arguments passed to the `picture_tag`.\n\n## More information\n\n* [Picturefill](http://scottjehl.github.io/picturefill/), the neat polyfill used by this gem\n* [Specification](http://picture.responsiveimages.org/) provided by [Responsive Images Community Group](http://responsiveimages.org)\n\n## Contributing\n\n1. Fork it ( https://github.com/tomasc/picture_tag/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fpicture_tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasc%2Fpicture_tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fpicture_tag/lists"}