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

grunt-svg-toolkit

v0.1.1

Published

> A toolkit for working with, styling and converting SVG files

Downloads

10

Readme

grunt-svg-toolkit

A toolkit for working with, styling and converting SVG files.

SVG Toolkit helps you work with SVG files by normalizing, colorizing, styling and optionally converting them to other formats, ready for production use.

A few example uses:

  • Create colorized SVGs and PNGs across an entire SVG icon set. Colors in your design changing? No problem... update your grunt file and re-run. Done. No need to open your design tools to update and re-export all your assets.

  • Use a CSS file to generate customized, themed SVG and PNG output assets.

  • SVG markup cleanup and normalization, decreasing asset size and increasing performance.

Vector workflow powerup ProTip:

SVG Toolkit works great with the output generated from our Illustrator SVG Exporter!

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

Install

npm install --save-dev grunt-svg-toolkit

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-svg-toolkit');

svgtoolkit task

Run this task with the grunt svgtoolkit command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Usage

Gruntfile Configuration

svgtoolkit: {
  dist: {
    options: {
      generatePNGs: true,
      style: 'src/css/themes/blue.css',
      colorize: '#808000',
      debug: false
    },
    files: [
      {
        expand: true,
        cwd: 'src/icons/',
        src: '**/*.svg',
        dest: 'dist/icons'
      }
    ]
  }

Options

generatePNGs

Type: Boolean
Default: true

Should PNGs be generated.

style

Type: String
Default: undefined

The location of a CSS file that should be applied to the SVG files. Great for creating a theme across an icon set and generating a matching set of SVGs/PNGs.

colorize

Type: String
Default: undefined

Define a hex color value (e.g. #d8dfd8) or HTML color name (e.g. thistle) to colorize the SVG files by setting their stroke and fill attributes. Great for colorizing a set of icons.

Note: The colorize setting, if set, will override the style setting.

debug

Type: Boolean
Default: false

Log task progress and details about the processing of each SVG.

Known Issues

  • SVG files with external font imports don't generate PNGs using those fonts currently. This will supposedly work in the upcoming PhantomJS 2, which has better font handling. Reference: https://github.com/ariya/phantomjs/issues/10592
<defs>
    <style>
        @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700);
    </style>
</defs>

Contributing

Your feedback is most welcome.

Have a troublesome SVG you are using that isn't generating the output you'd expect? Open an issue with the details and include the SVG markup for us to test with.

Have an awesome idea for a new feature or additional output format that would be useful? Create a feature request issue describing it, or even better... send a pull request!

Bugs? You know what to do.

Background

This project is the result of abstracting and generalizing the icon production process tools used in building Iconic, and to open source those pieces that might be more widely useful and applicable to the design and development communities.

Release History

v0.1.0 (01/20/2015)

  • Initial release

License

Copyright (c) 2015 Waybury, contributors. Licensed under the MIT license.