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-pwa-asset-generator

v1.7.3

Published

VueJS asset generator for PWA

Downloads

1,151

Readme

Vue PWA asset generator

npm npm

TLDR :

npx vue-pwa-asset-generator -a {512x512_png_source | svg_source} [-o {output_folder} [-b {fallback background color}]]

This package creates for you all the default assets used in a VueJS app with PWA plugin as well as a manifest JSON with the icons attribute set.

demo

Installation

You can use npx as shown above or you can install it globally:

npm install --global vue-pwa-asset-generator

or

yarn global add vue-pwa-asset-generator

or

pnpm global add vue-pwa-asset-generator

Usage

VueJS PWA asset generator has a vue-asset-generate command with two parameters :

  • -a: input asset, it can be an SVG file or a PNG file (the largest image is a 512x512 png image).
  • -o output folder (created if it does not exist). This parameter is optional, by default, vue-pwa-asset-generator will assume the command is run in a VueJS project. Therefor the manifest.json and favicon.ico are in public folder, the rest ies in public/img/icons folder.
  • -b, fallback background color for the ico image.
  • --no-manifest: option to not generate manifest.json file

Examples

  • vue-asset-generate -a logo.png -o img
  • vue-asset-generate -a logo.svg
  • vue-asset-generate -a logo.svg -o img
  • vue-asset-generate -a logo.svg -o img -b 182C61
  • vue-asset-generate -a logo.svg -o img -b "#9AECDB"

"Hey, I'm using the Vue plugin for pwa. Where do I put my manifest json?"

You can configure your PWA with the vue.config.js file.

Here an example of how you can merge the created manifest.json and your configuration file:

module.exports = {
  // ... other configurations
  pwa: {
    themeColor: "#130f40",
    msTileColor: "#130f40",
    name: "My app",
    manifestOptions: {
      icons: [
        {
          src: "./img/icons/android-chrome-192x192.png",
          sizes: "192x192",
          type: "image/png",
        },
        {
          src: "./img/icons/android-chrome-512x512.png",
          sizes: "512x512",
          type: "image/png",
        },
        {
          src: "./img/icons/android-chrome-maskable-192x192.png",
          sizes: "192x192",
          type: "image/png",
          purpose: "maskable",
        },
        {
          src: "./img/icons/android-chrome-maskable-512x512.png",
          sizes: "512x512",
          type: "image/png",
          purpose: "maskable",
        },
        {
          src: "./img/icons/apple-touch-icon-60x60.png",
          sizes: "60x60",
          type: "image/png",
        },
        {
          src: "./img/icons/apple-touch-icon-76x76.png",
          sizes: "76x76",
          type: "image/png",
        },
        {
          src: "./img/icons/apple-touch-icon-120x120.png",
          sizes: "120x120",
          type: "image/png",
        },
        {
          src: "./img/icons/apple-touch-icon-152x152.png",
          sizes: "152x152",
          type: "image/png",
        },
        {
          src: "./img/icons/apple-touch-icon-180x180.png",
          sizes: "180x180",
          type: "image/png",
        },
        {
          src: "./img/icons/apple-touch-icon.png",
          sizes: "180x180",
          type: "image/png",
        },
        {
          src: "./img/icons/favicon-16x16.png",
          sizes: "16x16",
          type: "image/png",
        },
        {
          src: "./img/icons/favicon-32x32.png",
          sizes: "32x32",
          type: "image/png",
        },
        {
          src: "./img/icons/msapplication-icon-144x144.png",
          sizes: "144x144",
          type: "image/png",
        },
        {
          src: "./img/icons/mstile-150x150.png",
          sizes: "150x150",
          type: "image/png",
        },
      ],
    },
  },
};

⚠️

When generating assets from a png file, the generator creates a black and white svg for the safari-pinned-tab.svg icon, some manual modifications may be necessary.

I hope this will be useful as it is for me! ♥