diff --git a/README.md b/README.md index 20dae1b5b..5ce483d86 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ logo -## SVGO [![NPM version](https://badge.fury.io/js/svgo.svg)](https://npmjs.org/package/svgo) +## SVGO [![npm version](https://img.shields.io/npm/v/svgo)](https://npmjs.org/package/svgo) -**SVG O**ptimizer is a Nodejs-based tool for optimizing SVG vector graphics files. -![](https://mc.yandex.ru/watch/18431326) +**SVG O**ptimizer is a Node.js-based tool for optimizing SVG vector graphics files. ## Why? @@ -14,7 +13,9 @@ SVG files, especially those exported from various editors, usually contain a lot ```sh npm -g install svgo ``` + or + ```sh yarn global add svgo ``` @@ -25,19 +26,21 @@ yarn global add svgo svgo one.svg two.svg -p one.min.svg two.min.svg ``` -Or use --folder, -f flag to optimize whole folder of svg icons +Or use the `--folder`/`-f` flag to optimize a whole folder of SVG icons + ```sh svgo -f ./path/to/folder/with/svg/files -o ./path/to/folder/with/svg/output ``` See help for advanced usage + ```sh svgo --help ``` ## Configuration -Some options can be configured with CLI though it may be easier to have configuration in separate file. +Some options can be configured with CLI though it may be easier to have the configuration in a separate file. SVGO automatically loads configuration from `svgo.config.js` or module specified with `--config` flag. ```js @@ -52,12 +55,12 @@ module.exports = { ``` SVGO has a plugin-based architecture, so almost every optimization is a separate plugin. -There is a set of [builtin plugins](#builtin-plugins). See how to configure them: +There is a set of [built-in plugins](#built-in-plugins). See how to configure them: ```js module.exports = { plugins: [ - // enable builtin plugin by name + // enable a built-in plugin by name 'builtinPluginName', // or by expanded version { @@ -74,8 +77,8 @@ module.exports = { } ``` -If `plugins` field is specified default list is fully overrided. To extend default -list use `extendDefaultPlugins` utility: +The default list is fully overridden if the `plugins` field is specified. To extend the default +list use the `extendDefaultPlugins` utility: ```js const { extendDefaultPlugins } = require('svgo'); @@ -91,7 +94,7 @@ module.exports = { } ``` -To disable one of default plugins use `active` field: +To disable one of the default plugins use the `active` field: ```js const { extendDefaultPlugins } = require('svgo'); @@ -105,7 +108,7 @@ module.exports = { } ``` -See the list of default plugins: +See the list of the default plugins: ```js module.exports = { @@ -147,7 +150,7 @@ module.exports = { } ``` -It's also possible to specify custom plugin: +It's also possible to specify a custom plugin: ```js const anotherCustomPlugin = require('./another-custom-plugin.js') @@ -187,30 +190,30 @@ const optimizedSvgString = result.data ### loadConfig -If you write a tool on top of svgo you might need a way to load svgo config. +If you write a tool on top of SVGO you might need a way to load SVGO config. ```js const { loadConfig } = require('svgo'); const config = await loadConfig() -// you can also specify relative or absolute path and customize current working directory +// you can also specify a relative or absolute path and customize the current working directory const config = await loadConfig(configFile, cwd) ``` -## Builtin plugins +## Built-in plugins | Plugin | Description | Default | | ------ | ----------- | ------- | | [cleanupAttrs](https://github.com/svg/svgo/blob/master/plugins/cleanupAttrs.js) | cleanup attributes from newlines, trailing, and repeating spaces | `enabled` | | [inlineStyles](https://github.com/svg/svgo/blob/master/plugins/inlineStyles.js) | move and merge styles from `