GithubHelp home page GithubHelp logo

1000ch / atom-svgo Goto Github PK

View Code? Open in Web Editor NEW
14.0 6.0 5.0 285 KB

Minify SVG with SVGO ๐Ÿฏ

Home Page: https://atom.io/packages/svgo

License: MIT License

JavaScript 100.00%
atom svg svgo atom-plugin

atom-svgo's Introduction

atom-svgo

Minify SVG with SVGO.

Build Status Dependency Status devDependency Status

demo

Install

$ apm install svgo

Usage

  • Packages > SVGO > Minify SVG or Prettify SVG
  • Context Menu > Minify SVG or Prettify SVG
  • Command Palette (โŒ˜ + shift + P) > Minify SVG or Prettify SVG

Config

Indent

Indent size to apply on prettify.

Disable

Plugin names (separated with space delimiter) to disable.

License

MIT ยฉ Shogo Sensui

atom-svgo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

atom-svgo's Issues

svgo empties buffer

Hello,
Previously this was working well for me... But using v2.8.1, anytime I svgo prettify or svgo minify in my Atom v1.15.0, it returns an empty buffer (no text in the editor).
svgo still works on command line. I've tried uninstalling and re-installing the atom package, still get the same error. Any hints on how to get it working again? Or where could I go to read an error log?
Thanks for this package and the support.

Uncaught TypeError: Cannot read property 'filter' of undefined

Atom Version: 1.5.4
System: linux 4.4.1-2-ARCH
Thrown From: svgo package, v1.0.3

Stack Trace

Uncaught TypeError: Cannot read property 'filter' of undefined

At /home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:46

TypeError: Cannot read property 'filter' of undefined
    at monkeys (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:46:38)
    at perItem (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:77:12)
    at /home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:18:24
    at Array.forEach (native)
    at module.exports (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:14:13)
    at /home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:63:17
    at Object.sax.onend (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/svg2js.js:140:26)
    at emit (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:639:35)
    at end (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:682:5)
    at Object.write (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:989:14)
    at Object.SAXParser.close (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:156:38)
    at module.exports (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo/svg2js.js:144:21)
    at [object Object].SVGO._optimizeOnce (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:56:5)
    at [object Object].SVGO.optimize (/home/buzz-dee/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:48:11)
    at minify (/home/buzz-dee/.atom/packages/svgo/index.js:27:10)
    at atom-workspace.<anonymous> (/home/buzz-dee/.atom/packages/svgo/index.js:37:60)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:570:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:378:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/usr/share/atom/resources/app.asar/src/window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:09.4.0 application:new-file (atom-text-editor.editor.is-focused)
  2x -0:08.2.0 svgo:minify (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "autoHideMenuBar": true
  }
}

Installed Packages

# User
atom-beautify, v0.28.25
atom-ternjs, v0.13.2
autocomplete-python, v1.7.0
color-picker, v2.1.1
emmet, v2.4.1
highlight-selected, v0.11.2
language-fish-shell, v1.0.3
language-svg, v0.9.2
minimap, v4.19.0
minimap-highlight-selected, v4.3.1
minimap-pigments, v0.1.7
pigments, v0.24.2
project-manager, v2.7.6
python-debugger, v0.0.2
python-indent, v0.4.1
python-isort, v0.0.7
python-tools, v0.6.7
svg-preview, v0.7.4
svgo, v1.0.3
term3, v0.21.2

# Dev
No dev packages

svgo ENOENT

I just installed this package and it is erroring on me every time I minify or prettify an SVG file:

Error: spawn C:\Users\<user>\.atom\packages\svgo\node_modules\.bin\svgo ENOENT(โ€ฆ)(anonymous function) @ /C:/Users/<user>/.atom/packages/svgo/index.js:35

Atom 1.7.1
Windows 8.1 x64
svgo 2.0.0

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an al...

Hi,

I got this error message with a fresh install of the svgo plugin, hope you can help.

Atom Version: 1.7.1
System: Ubuntu 15.10
Thrown From: svgo package, v1.2.5

Stack Trace

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

At /home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/csso/lib/compressor/index.js:74

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

    at Function (native)
    at compress (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/csso/lib/compressor/index.js:74:74)
    at minify (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/csso/lib/index.js:95:9)
    at Object.minifyBlock (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/csso/lib/index.js:120:12)
    at Object.exports.fn (/home/sebj/.atom/packages/svgo/node_modules/svgo/plugins/minifyStyles.js:38:42)
    at /home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:59:45
    at Array.filter (native)
    at monkeys (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:46:39)
    at perItem (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:77:12)
    at /home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:18:24
    at Array.forEach (native)
    at module.exports (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/plugins.js:14:13)
    at /home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:63:17
    at Object.sax.onend (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/svg2js.js:156:13)
    at emit (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:640:35)
    at end (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:683:5)
    at Object.write (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:991:14)
    at Object.SAXParser.close (/home/sebj/.atom/packages/svgo/node_modules/svgo/node_modules/sax/lib/sax.js:157:38)
    at module.exports (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo/svg2js.js:169:28)
    at [object Object].SVGO._optimizeOnce (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:56:5)
    at [object Object].SVGO.optimize (/home/sebj/.atom/packages/svgo/node_modules/svgo/lib/svgo.js:49:11)
    at minify (/home/sebj/.atom/packages/svgo/index.js:27:10)
    at atom-workspace.<anonymous> (/home/sebj/.atom/packages/svgo/index.js:37:60)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at /usr/share/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/usr/share/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:00.9.0 svgo:minify (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "open-on-search-engine",
      "symbols-view",
      "lmgtfy",
      "lmgtfy"
    ],
    "packagesWithKeymapsDisabled": [
      "svgo"
    ],
    "themes": [
      "soft-flat-ui",
      "soft-flat-ui-syntax"
    ]
  }
}

Installed Packages

# User
atom-minify, v0.7.1
emmet, v2.4.3
file-types, v0.5.1
highlight-selected, v0.11.2
minimap, v4.22.1
release-notes, v0.53.0
remote-sync, v4.0.1
set-syntax, v0.3.0
soft-flat-ui, v0.1.0
soft-flat-ui-syntax, v0.1.0
svgo, v1.2.5
sync-settings, v0.7.2
trailing-spaces, v0.3.2
webbox-color, v0.5.9

# Dev
No dev packages

Allow options for SVGO

Would love to be able to pass options into SVGO. The way this strips viewBox from all SVG's be default really makes SVG's not play nicely with CSS sizing.

Is there any way to specify options?

It doesn't look like theres any way to set options. I'd like to disable cleanupIDs. Maybe there should just be a settings text input that will pass all contents as params to the call?

Remove data-name attr

Since there is no way to pass custom option to SVGO from the plugin, it would be nice if it could remove data-name attributes as they are generated by Adobe Experience Design (XD).

Add --pretty option

Thanks for the neat plugin. Adding the ability to use the SVGO --pretty option would double the usefulness. When I have an SVG open in Atom it is usually because I need to manually work it before and after running SVGO, for example add a missing <title>, strip unnecessary fills, convert <g> to <symbol> and paste in other layers, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.