All Projects β†’ Angelmmiguel β†’ Svgi

Angelmmiguel / Svgi

Licence: apache-2.0
πŸ”Ž The SVG inspection tool

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Svgi

Vue Eva Icons
Is a pack of more than 480 beautiful open source Eva icons as Vue components
Stars: ✭ 189 (-67.36%)
Mutual labels:  svg, svg-icons
Svg Inject
A tiny, intuitive, robust, caching solution for injecting SVG files inline into the DOM.
Stars: ✭ 559 (-3.45%)
Mutual labels:  svg, svg-icons
Small N Flat
svg icons on a 24px grid
Stars: ✭ 205 (-64.59%)
Mutual labels:  svg, svg-icons
Akar Icons
A perfectly rounded icon library made for designers, developers, and pretty much everyone.
Stars: ✭ 184 (-68.22%)
Mutual labels:  svg, svg-icons
Bytesize Icons
Tiny style-controlled SVG iconset (101 icons, 12kb)
Stars: ✭ 3,662 (+532.47%)
Mutual labels:  svg, svg-icons
Weather Underground Icons
Weather Underground Icons ( PNG & SVG )
Stars: ✭ 186 (-67.88%)
Mutual labels:  svg, svg-icons
Svg Credit Card Payment Icons
SVG Credit Card & Payment Icons: 6 Styles, 80 Icons
Stars: ✭ 227 (-60.79%)
Mutual labels:  svg, svg-icons
React Native Svg Icon
A simple, but flexible SVG icon component for React Native
Stars: ✭ 164 (-71.68%)
Mutual labels:  svg, svg-icons
Grayshift
A lightweight front-end component library for developing fast and powerful web interfaces.
Stars: ✭ 304 (-47.5%)
Mutual labels:  svg, svg-icons
Svgson
Transform svg files to json notation
Stars: ✭ 271 (-53.2%)
Mutual labels:  svg, svg-icons
Feathericon
simply generic vector icon collection - including sketch file, svg files, and font files.
Stars: ✭ 178 (-69.26%)
Mutual labels:  svg, svg-icons
Jam
Jam icons is a set of SVG icons designed for web projects, illustrations, print projects, etc. Licensed under MIT
Stars: ✭ 398 (-31.26%)
Mutual labels:  svg, svg-icons
File Icon Vectors
A collection of file type icons in SVG format
Stars: ✭ 171 (-70.47%)
Mutual labels:  svg, svg-icons
Supertinyicons
Under 1KB each! Super Tiny Icons are miniscule SVG versions of your favourite website and app logos
Stars: ✭ 13,177 (+2175.82%)
Mutual labels:  svg, svg-icons
Materialdesign Svg
@mdi/svg Dist for Material Design Icons.
Stars: ✭ 166 (-71.33%)
Mutual labels:  svg, svg-icons
React Kawaii
Cute SVG React Components
Stars: ✭ 2,709 (+367.88%)
Mutual labels:  svg, svg-icons
Angular Svg Icon
Angular component for inlining SVGs allowing them to be easily styled with CSS.
Stars: ✭ 151 (-73.92%)
Mutual labels:  svg, svg-icons
Webfonts Loader
Make an icon font from SVGs!
Stars: ✭ 153 (-73.58%)
Mutual labels:  svg, svg-icons
Vectorlogozone
3,000+ gorgeous SVG logos, perfect for your README or credits page
Stars: ✭ 239 (-58.72%)
Mutual labels:  svg, svg-icons
Vue Sample Svg Icons
An opinionated example of how to use SVG icons in a Vue.js application
Stars: ✭ 399 (-31.09%)
Mutual labels:  svg, svg-icons

npm version Build Status FOSSA Status All Contributors

svgi

svgi is a CLI tool to inspect the content of SVG files. It provides you information about the file, the elements in the SVG and the hierarchy. It also count the number of elements and in the future, it will provide tips to improve the SVG

asciicast

Installation

CLI

svgi is written in javascript (node) and distributed through npm. Both are required to install svgi.

To install it, just execute the following command in the terminal:

npm install -g svgi

Then, svgi will be available in your path:

svgi --help

  Usage: svgi [options] <file>

  Options:

    -h, --help                output usage information
    -o, --output <formatter>  Select the format of the output: json, yaml, or human (default)
    -t, --tree                Display only the node tree
    -b, --basic               Display only the basic information
    -s, --stats               Display only the node statistics
    --all-stats               Return types and categories with 0 ocurrences in the stats object
    --ids                     Show the IDs of the nodes in the tree view. Only available for human formatter
    --props                   Show the properties of the nodes in the tree view. Only available for human formatter
    --legend                  Show the tree color legend. Only available for human formatter

Node Version

svgi requires a > 6 node version because it uses some features from the new versions of ECMAScript.

Binary files

We are providing executable files for the environments that do not fit within current requirements. Binaries for Linux, macOS, and Windows can be downloaded from the releases page on GitHub.

Library

You can also integrate svgi in your projects. This library will provide you a powerful way to get information about SVG files. We only need to install the library and add it as a depedency in our project:

npm install --save svgi

Now, you can start to inspect SVG files from your code :)

const SVG = require('svgi');

let svg = new SVG('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect x="10" y="10" height="100" width="100" style="fill: #0000ff"/></svg>');
// Get the report
svg.report();
/*
{ stats:
   { totalNodes: 2,
     types: { svg: 1, rect: 1 },
     categories: { containers: 1, shapes: 1 } },
  nodes:
   { type: 'svg',
     category: 'containers',
     properties:
      { xmlns: 'http://www.w3.org/2000/svg',
        'xmlns:xlink': 'http://www.w3.org/1999/xlink' },
     children: [ [Object] ] } }
*/

CLI Output

You can change the output format of the CLI with the -o option.

Human

This is the default option. Also, we're working on this format.

svgi icon.svg
Basic information
β”Œβ”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Name β”‚ icon.svg                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path β”‚ /Users/angel/Projects/svgi/icon.svg β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Size β”‚ 204                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Node statistics
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”
β”‚ Total Nodes β”‚ 14 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Type β”‚ Count β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ svg  β”‚ 1     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ g    β”‚ 4     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ rect β”‚ 3     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ path β”‚ 4     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ text β”‚ 2     β”‚
β””β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Category   β”‚ Count β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ containers β”‚ 5     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ shapes     β”‚ 7     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€
β”‚ text       β”‚ 2     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

Node tree
svg
β”œβ”€ g
β”‚  └─ g
β”‚     └─ g
β”‚        β”œβ”€ rect
β”‚        β”œβ”€ rect
β”‚        └─ g
β”‚           β”œβ”€ rect
β”‚           β”œβ”€ path
β”‚           β”œβ”€ path
β”‚           β”œβ”€ path
β”‚           └─ path
β”œβ”€ text
└─ text

JSON

svgi -o json icon-small.svg
{
  "file": {
    "name": "icon-small.svg",
    "path": "/Users/angel/Projects/svgi/icon-small.svg",
    "size": 204
  },
  "stats": {
    "totalNodes": 2,
    "types": {
      "svg": 1,
      "path": 1
    },
    "categories": {
      "containers": 1,
      "shapes": 1
    }
  },
  "nodes": {
    "type": "svg",
    "category": "containers",
    "properties": {
      "viewBox": "0 0 16 16",
      "xmlns": "http://www.w3.org/2000/svg",
      "fill-rule": "evenodd",
      "clip-rule": "evenodd",
      "stroke-linejoin": "round",
      "stroke-miterlimit": "1.414"
    },
    "children": [
      {
        "type": "path",
        "category": "shapes",
        "properties": {
          "d": "M5.667 2.667H7V16H5.667V2.667zm4.666 0V16H9V2.667h1.333zM2.333 0h1.334v10H2.333V0zm10 2.667h1.334V10h-1.334V2.667z"
        },
        "children": []
      }
    ]
  }
}

Combine JSON output with jq

You can use the well known jq command-line JSON processor to read and filter the output of the JSON formatter:

svgi -o json icon.svg | jq '.nodes.properties'
{
  "viewBox": "0 0 16 16",
  "xmlns": "http://www.w3.org/2000/svg",
  "fill-rule": "evenodd",
  "clip-rule": "evenodd",
  "stroke-linejoin": "round",
  "stroke-miterlimit": "1.414"
}

YAML

svgi -o yaml icon.svg
file:
  name: icon-small.svg
  path: /Users/angel/Projects/svgi/icon-small.svg
  size: 204
stats:
  totalNodes: 2
  types:
    svg: 1
    path: 1
  categories:
    containers: 1
    shapes: 1
nodes:
  type: svg
  category: containers
  properties:
    viewBox: 0 0 16 16
    xmlns: 'http://www.w3.org/2000/svg'
    fill-rule: evenodd
    clip-rule: evenodd
    stroke-linejoin: round
    stroke-miterlimit: '1.414'
  children:
    - type: path
      category: shapes
      properties:
        d: >-
          M5.667 2.667H7V16H5.667V2.667zm4.666 0V16H9V2.667h1.333zM2.333
          0h1.334v10H2.333V0zm10 2.667h1.334V10h-1.334V2.667z
      children: []

Limit the output

The params -b, --basic, -s, --stats and -t, --tree allow you to limit the output of the command:

svgi --stats -o json icon.svg
{
  "stats": {
    "totalNodes": 14,
    "types": {
      "svg": 1,
      "g": 4,
      "rect": 3,
      "path": 4,
      "text": 2
    },
    "categories": {
      "containers": 5,
      "shapes": 7,
      "text": 2
    }
  }
}

License

svgi is released under the Apache License v2.0. Developed by @Laux_es ;).

Sponsors

Sponsor

Contributors

Thanks goes to these wonderful people (emoji key):


Ángel M

πŸ› πŸ’» 🎨 πŸ“–

AarΓ³n GarcΓ­a HervΓ‘s

πŸ’»

Steve Layton

πŸ“–

Joshua Fuller

πŸ’»

Lionel

πŸ’» πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].