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-svg-custom-icon

v1.0.7

Published

Use SVG custom icon easily in your Vue.js (2.x) application

Downloads

26

Readme

vue-svg-custom-icon

A lightweight component with no dependecy to allow use of custom SVG icons in your Vue.js application based on SVG sprite.

Installation

Using NPM:

npm install vue-svg-custom-icon --save

Requirements

  • Vue.js (2.x+)
  • svgxuse polyfill to support IE9-11 version
  • SVG sprite file that should be available in "/static" folder by default (can be changed, more details in configuration section)

TIP: you can use create-svg-sprite package to create SVG sprite with no build configuration based on SVG files from given folder.

Usage

In your main.js file:

import VueSVGCustomIcon from 'vue-svg-custom-icon'
Vue.use(VueSVGCustomIcon)

In your components:

  <svg-icon name="svg_icon_name" :size="64"></svg-icon>
  • name - SVG sprite symbol id value (note below)
  • size - icon size in px (16 is default)

NOTE: Assuming your SVG sprite looks like below:

<!-- SVG sprite example -->
<?xml version="1.0" encoding="utf-8"?>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol style="isolation:isolate" viewBox="0 0 20 22" id="alarm">
    <path d="M2.143 17.6l2.143-4.4V7.333c0-3.24 2.558-5.866 5.714-5.866 3.156 0 5.714 2.626 5.714 5.866V13.2l2.143 4.4H2.143zM10 20.533c-.932 0-1.716-.613-2.011-1.466h4.022c-.295.853-1.079 1.466-2.011 1.466zm7.143-7.333V7.333C17.143 3.283 13.944 0 10 0S2.857 3.284 2.857 7.333V13.2L0 19.067h6.5C6.832 20.74 8.273 22 10 22s3.169-1.26 3.5-2.933H20L17.143 13.2z" fill-rule="evenodd"/>
  </symbol>
</svg>
  <!-- Alarm icon usage based on above SVG sprite -->
  <svg-icon name="alarm" :size="32"></svg-icon>

Configuration

By default, <svg-icon> component will look for SVG sprite in "/static" folder. Provide "basePath" options to change the default path:

import VueSVGCustomIcon from 'vue-svg-custom-icon'
Vue.use(VueSVGCustomIcon, { basePath: '/assets' })