Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Easily insert placeholder images in your HTML pages using Polymer and web components.

Notifications You must be signed in to change notification settings

zacharytamas/img-placeholder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<img-placeholder>

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.

Demo

Check it live!

Install

Install the component using Bower:

$ bower install img-placeholder --save

Or download as ZIP.

Usage

  1. Import Web Components' polyfill:

    <script src="bower_components/platform/platform.js"></script>
  2. Import Custom Element:

    <link rel="import" href="bower_components/img-placeholder/dist/img-placeholder.html">
  3. Start using it!

    <img-placeholder></img-placeholder>

Options

<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.

Development

In order to run it locally you'll need to fetch some dependencies and a basic server setup.

  • Install Bower & Grunt:

    $ [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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

For detailed changelog, check Releases.

License

MIT License

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.

About

Easily insert placeholder images in your HTML pages using Polymer and web components.

Resources

Stars

Watchers

Forks

Packages

No packages published