UNPKG

motion

Version:

motion - moving development forward

82 lines (81 loc) 5.38 kB
{ "_args": [ [ "postcss-svgo@https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "/Users/nw/flint/packages/flint" ] ], "_from": "postcss-svgo@>=2.0.4 <3.0.0", "_id": "postcss-svgo@2.1.1", "_inCache": true, "_location": "/postcss-svgo", "_phantomChildren": {}, "_requested": { "name": "postcss-svgo", "raw": "postcss-svgo@https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "rawSpec": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "scope": null, "spec": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "type": "remote" }, "_requiredBy": [ "/cssnano" ], "_resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "_shasum": "dac5b375d092789d64bbfcabe9dc7486b8aa8ecd", "_shrinkwrap": null, "_spec": "postcss-svgo@https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-2.1.1.tgz", "_where": "/Users/nw/flint/packages/flint", "author": { "email": "beneb.info@gmail.com", "name": "Ben Briggs", "url": "http://beneb.info" }, "bugs": { "url": "https://github.com/ben-eb/postcss-svgo/issues" }, "dependencies": { "is-svg": "^1.1.1", "postcss": "^5.0.2", "postcss-value-parser": "^3.0.1", "svgo": "^0.6.1" }, "description": "Optimise inline SVG with PostCSS.", "devDependencies": { "babel": "^5.8.21", "babel-tape-runner": "1.2.0", "pleeease-filters": "^2.0.0", "tap-spec": "^4.1.0", "tape": "^4.2.0" }, "files": [ "LICENSE-MIT", "dist" ], "homepage": "https://github.com/ben-eb/postcss-svgo", "keywords": [ "css", "minify", "optimise", "postcss", "postcss-plugin", "svg", "svgo" ], "license": "MIT", "main": "dist/index.js", "name": "postcss-svgo", "optionalDependencies": {}, "readme": "# [postcss][postcss]-svgo [![Build Status](https://travis-ci.org/ben-eb/postcss-svgo.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-svgo.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-svgo.svg)][deps]\n\n> Optimise inline SVG with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-svgo) do:\n\n```\nnpm install postcss-svgo --save\n```\n\n## Example\n\n### Input\n\n```css\nh1 {\n background: url('data:image/svg+xml;charset=utf-8,<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"><svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"yellow\" /></svg>');\n}\n```\n\n### Output\n\n```css\nh1 {\n background: url('data:image/svg+xml;charset=utf-8,<svg xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#ff0\"/></svg>');\n}\n```\n\n## API\n\n### `svgo([options])`\n\nNote that postcss-svgo is an *asynchronous* processor. It cannot be used\nlike this:\n\n```js\nvar result = postcss([ svgo() ]).process(css).css;\nconsole.log(result);\n```\n\nInstead make sure your PostCSS runner uses the asynchronous API:\n\n```js\npostcss([ svgo() ]).process(css).then(function (result) {\n console.log(result.css);\n});\n```\n\n#### options\n\n##### encode\n\nType: `boolean`\nDefault: `undefined`\n\nIf `true`, it will encode URL-unsafe characters such as `<`, `>` and `#`;\n`false` will decode these characters, and `undefined` will neither encode nor\ndecode the original input.\n\n##### plugins\n\nOptionally, you can customise the output by specifying the `plugins` option. You\nwill need to provide the config in comma separated objects, like the example\nbelow. Note that you can either disable the plugin by setting it to `false`,\nor pass different options to change the default behaviour.\n\n```js\nvar postcss = require('postcss');\nvar svgo = require('postcss-svgo');\n\nvar opts = {\n plugins: [{\n removeDoctype: false\n }, {\n removeComments: false\n }, {\n cleanupNumericValues: {\n floatPrecision: 2\n }\n }, {\n convertColors: {\n names2hex: false,\n rgb2hex: false\n }\n }]\n};\n\npostcss([ svgo(opts) ]).process(css).then(function (result) {\n console.log(result.css)\n});\n```\n\nYou can view the [full list of plugins here][plugins].\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributing\n\nPull requests are welcome. If you add functionality, then please add unit tests\nto cover it.\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[ci]: https://travis-ci.org/ben-eb/postcss-svgo\n[deps]: https://gemnasium.com/ben-eb/postcss-svgo\n[npm]: http://badge.fury.io/js/postcss-svgo\n[postcss]: https://github.com/postcss/postcss\n[plugins]: https://github.com/svg/svgo/tree/master/plugins\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/ben-eb/postcss-svgo.git" }, "scripts": { "prepublish": "babel src --out-dir dist --ignore /__tests__/", "test": "npm run test-unformatted | tap-spec", "test-unformatted": "babel-tape-runner \"src/**/__tests__/*.js\"" }, "version": "2.1.1" }