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

@netsells/nuxt-icons8

v0.4.0

Published

A simple module to provide an Icons8 SVG spritesheet to your Nuxt app

Downloads

21

Readme

Nuxt Icons8 Module

A simple module to provide an Icons8 SVG spritesheet to your Nuxt app

This module aims to make it easier to integrate with Icons8 in a more uniform way, allowing you to simply pass in your SVG file and have it globally provided to your app.

Why does this component use SVGs rather than font?

Fonts are inherently bad, and are penalised by tools such as Google PageSpeed and Lighthouse as they are an additional request. Add to this issues with accessibility and general size of these files, it's highly recommended to use SVGs for application icons.

What does this module do?

A global component will be registered in your app, and this can be referenced using the componentName provided or app-icon by default.

<template>
    <app-icon name="email" />
</template>

<style lang="scss" scoped>
    // SVG "fill" will use the font colour provided, 
    // and will inherit the current colour if not set
    .app-icon {
        color: red;
    }
</style>

Normalisation

If the normaliseSpritesheet option is set to true the sprite sheet will automatically have all fill attributes removed. This is because the fill on the icons will be enforced by the font color css value and inherited by currentColor in the component CSS.

If set to false for any reason, it can be enabled on a per-component basis using the :normalise="false" prop on the component.

Usage

Install the module:

$ yarn add @netsells/nuxt-icons8

Add the module to your nuxt config:

modules: {
    // Other modules
    '@netsells/nuxt-icons8',
}, 

Configure the module to your needs:

icons8: {
    spritePath: '',
    componentName: '',
    normaliseSpritesheet: true,
},

Options

spritePath

Path to your svg spritesheet in your application

  • Default: ''
  • Type: string
  • Required

componentName

The name of the global icon component

  • Default: 'app-icon'
  • Type: string

normaliseSpritesheet

Whether to apply normalisation to the spritesheet. See above for details

  • Default: true
  • Type: boolean

Storybook

This component can be utilised in storybook by first doing a build of your nuxt app. This will generate the .nuxt folder with the generated component from this module. You can then register it globally in your storybook project by simply pulling in the generated file:

import '../.nuxt/icons8/plugin';