npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-holderjs

v1.0.2

Published

A Vue.js directive for HolderJS

Downloads

317

Readme

vue-holder

A Vue.js directive for HolderJS. Holder renders image placeholders on the client side using SVG.

Installing

Install with yarn:

yarn add vue-holderjs

Install with npm:

npm install vue-holderjs --save-dev

Add as a dependency in your Vue app:

import VueHolder from 'vue-holderjs';
Vue.use(VueHolder);

Include from a CDN:

<script src="https://unpkg.com/vue-holderjs"></script>

Usage example

<template>
  <main>
    <!-- using without parameters (defaults to a 100% by 100% image to full the container) -->
    <div style="width:400px;height:100px">
      <img v-holder>
    </div>
    <!-- using object from the data object -->
    <img v-holder="holder">
    <!-- using string -->
    <img v-holder="'img=100px200?auto=yes&theme=social&text=Full width'">
    <!-- using object -->
    <img v-holder="{img:'150x150',theme: 'github', text:'150 Fixed!'}">
  </main>
</template>

<script>
import VueHolder from 'vue-holderjs';
Vue.use(VueHolder);
	
export default {
  name: 'Example',
  data () {
    return {
      holder: {
        img: '200x200',
        auto: 'yes',
        theme: 'vue'
      }
    }
  }
}
</script>

JSFiddle Example

Placeholder options

Holder options are set through an object.

  • theme: The theme to use for the placeholder.
  • random: Use random theme.
  • bg: Background color.
  • fg: Foreground (text) color.
  • text: Custom text. Example:
  • size: Custom text size. Defaults to pt units.
  • font: Custom text font.
  • align: Custom text alignment (left, right).
  • outline: Draw outline and diagonals for placeholder.
  • lineWrap: Maximum line length to image width ratio.

Themes

Holder includes the 6 default themes: sky, vine, lava, gray, industrial, and social and aditionals vue, facebook, twitter, youtube, tumblr, github, whatsapp

Important: When testing locally, font URLs must have a http or https protocol defined.

Important: Fonts served from locations other than public registries (i.e. Google Fonts, Typekit, etc.) require the correct CORS headers to be set. See How to use CDN with Webfonts for more details.

Fluid placeholders

Important: Percentages are specified with the p character, not with the % character.

Specifying a dimension in percentages creates a fluid placeholder that responds to media queries.

<img v-holder="'img=100px75?theme=social'">

By default, the fluid placeholder will show its current size in pixels. To display the original dimensions, i.e. 100%x75, set the textmode flag to literal like so: img=100px75?textmode=literal.

Automatically sized placeholders

If you'd like to avoid Holder enforcing an image size, use the auto flag like so:

<img v-holder="'img=200x200?auto=yes'">

The above will render a placeholder without any embedded CSS for height or width.

To show the current size of an automatically sized placeholder, set the textmode flag to exact like so: img200x200?auto=yes&textmode=exact.

License

Holder is provided under the MIT License.

Credits

HolderJS is a project by Ivan Malopinsky.

Change History

v1.0.2 - 2017/11/05

  • Updated webpack config files
  • Updated package.json
  • Updated README to included more examples
  • Split into 2 versions one for node and one for the browser
  • Removed unused libraries and tidy up the code

v1.0.0 - 2017/05/24

  • Initial release