DEPRECATED: This component is based on a very old version of Polymer and is no longer being updated.
Easily insert placeholder images in your HTML pages using Polymer and web components.
Originally by Zachary Jones. Uses Placehold.it for the placeholder images.
Install the component using Bower:
$ bower install img-placeholder --save
Or download as ZIP.
-
Import Web Components' polyfill:
<script src="bower_components/platform/platform.js"></script>
-
Import Custom Element:
<link rel="import" href="bower_components/img-placeholder/dist/img-placeholder.html">
-
Start using it!
<img-placeholder></img-placeholder>
<img-placeholder>
intentionally shadows the spec of the regular HTML <img>
so that you can easily convert it to a real <img>
tag in the future when you have the final image you want to show.
Attribute | Options | Default | Description |
---|---|---|---|
width |
integer | 256 |
Width of the image. |
height |
integer | 256 |
Height of the image. |
alt |
string | '' |
Optional. Text to be shown on image. |
src |
string | '' |
Optional. Image filename with extension. Used to generate correct image type. Default is a GIF. |
In order to run it locally you'll need to fetch some dependencies and a basic server setup.
-
$ [sudo] npm install -g bower grunt-cli
-
Install local dependencies:
$ bower install && npm install
-
To test your project, start the development server and open
http://localhost:8000
.$ grunt server
-
To build the distribution files before releasing a new version.
$ grunt build
-
To provide a live demo, send everything to
gh-pages
branch.$ grunt deploy
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
For detailed changelog, check Releases.
Copyright (c) 2014 Zachary Jones
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.