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

svg2png-loader

v1.0.1

Published

Webpack Loader to rasterize SVG vector into multiple PNG images for different pixel-ratios using PhantomJS

Downloads

1

Readme

svg2png-loader Build Status

Webpack Loader to convert SVG to multiple PNG images for different pixel-ratios using PhantomJS

Goals

  • No platform dependencies (Inkscape, Imagick, etc...)
  • Fallback (IE)
  • Image src-set (Browser)
  • SVG import for NativeImage (Electron, supporting ratios for retina)

Highlights

  • Type-strict as possible (TypeScript)
  • ES7
  • Pixel-ratio support

Install

$ npm i -D svg2png-loader

Usage

Basic usage with multiple pixel-ratios:

module.exports = {
    module : {
        rules : [ 
            { 
                test : /\.svg$/, 
                loader : 'svg2png-loader',
                options : { 
                    ratios : [ 1, 2, 3 ]
                }
            } 
        ]
    }
};

Options

ratios

Type: number[]
Default: [ 1 ]

Pixel-ratios to render during the load.

name

Type: string
Default: "[name].[hash:7][suffix].[ext]"

The name pattern of exported asset, according to Webpack standards. The [suffix] must be on the end with its default value to work with Electron properly.

type

Type: string
Accepted values: "js", "es", "typescript"
Default: "js"

You can specify the export syntax if want to chain together with another loader, like babel-loader or ts-loader. The TypeScript version includes module level type-definitions if the globals wouldn't work in your IDE context.

optimize

Type: boolean

If enabled and imagemin-optipng is installed as a peer-dependency, then the compiled assets will be optimized after the rendering process is done. If not set, then it will try to apply on production, but not in other environments.

suffix

Type: string
Default: "@[ratio]x"

Pattern of the suffix.

forceSuffix

Type: boolean
Default: false

If disabled, then the default exported size (1x) won't be suffixed.

License

MIT © 2020, Székely Ádám