1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00
Commit Graph

35 Commits

Author SHA1 Message Date
07f8d606e0 Implement preset-default plugin (#1513)
I saw complaints about `extendDefaultPlugins` api

- it cannot be used when svgo is installed globally
- it requires svgo to be installed when using svgo-loader or svgo-jsx
- it prevents using serializable config formats like json

In this diff I introduced the new plugin which is a bundle of all
default plugins.

```js
module.exports = {
  plugins: [
    'preset_default',
    // or
    {
      name: 'preset_default',
      floatPrecision: 4,
      overrides: {
        convertPathData: {
          applyTransforms: false
        }
      }
    }
  ]
}
```
2021-08-13 19:07:08 +03:00
c3695ae533 Migrate to jest (#1520)
Mocha doesn't have a lot of features provided by jest.
There is a great assertion library out of the box.
And the most cool feature is inline snapshots.
Mocha also hides errors which makes debugging a nightmare sometimes.
2021-08-12 18:06:10 +03:00
19c77d2398 Add mergeStyles plugin (#1381) 2021-03-27 16:59:56 +03:00
7389bcddbf Override default floatPrecision with global
Ref https://github.com/svg/svgo/issues/1426

Previously extendDefaultPlugins incorrectly overrided global
floatPrecision.
2021-03-22 19:36:05 +03:00
13a0ad056b Specify --ignore-path for ESLint (#1443)
Otherwise, all files are included
2021-03-21 17:57:55 +03:00
b903de9554 test/config/_index.js: fix find usage (#1438) 2021-03-20 19:51:33 +03:00
d58a7e6089 Pass floatPrecision to implemented plugin 2021-03-05 17:48:19 +03:00
a99cc08e4f Format tests with prettier (#1380)
Will format the code with prettier in a few commits.
2021-02-27 23:17:47 +03:00
a855b40ec5 Fail when specified config is wrong or json is specified 2021-02-22 23:50:42 +03:00
330e78b479 Fix reporting of config errors (#1342)
Errors are swallowed while resolving.
2021-02-19 12:11:35 +03:00
a6f14018ee Implement loadConfig utility (#1328)
Ref https://github.com/svg/svgo/issues/1327

Config file now can only be js. `svgo.config.js` is searched by default.
Otherwise any js module specified in `--config` cli flag.

Config loader is exposed in entry point as `loadConfig(configFile, cwd)`.
2021-02-16 19:11:13 +03:00
b1dafc6780 Implement default plugins and plugins list extending 2021-02-15 22:20:05 +03:00
225bfbb053 Move config processing into optimize 2021-02-15 16:57:01 +03:00
1b776ffea5 Simplify plugins configuration (#1324)
- replaced named plugin object with "name" field
- dropped support for params in plugin object; use only params to pass plugin options
- dropped support for "boolean plugins"; use active field instead

```diff
-{
-  pluginName: {
-    fn,
-    params: {},
-    ...params
-  }
-}
+{
+  name: 'pluginName',
+  fn,
+  params: {}
+}
```
2021-02-15 14:30:09 +03:00
6cecd76f62 Remove config extending and full flag support 2021-02-15 13:12:29 +03:00
8899f682b8 Remove coverage imports from tests 2021-02-15 02:41:28 +03:00
bc44ab3f29 Refactor assertions with chai expect 2021-02-14 15:12:41 +03:00
1bdee52393 Fixed config issues, better tests&docs. Closes #390 2015-09-21 14:23:55 +03:00
1ec50c4a13 Allow providing custom plugins
Eg.

    new SVGO({
        plugins: [
            myCustomPugin: {
                type: ‘perItem’,
                fn:   function(item) {
                    /* do stuff */
                }
            }
        ]
    });
2015-06-02 11:41:34 +01:00
1dd57cabe1 Istanbul + coveralls.io 2013-04-15 20:35:55 +03:00
2dea171f8e replace default config with full: true 2013-04-11 19:51:29 +03:00
a2da6fe894 CONFIG.extend() + CONFIG.replace() + tests 2013-04-10 18:12:14 +03:00
a0d409389f yaml.js -> js-yaml; update outdated deps 2013-02-09 13:03:29 +02:00
ab5610a197 fix mocha-as-promised plug in node 0.6 2012-12-06 00:25:00 +02:00
354b2ed46a mocha + mocha-as-promised + chai + chai-as-promised + should + istanbul = <3 2012-12-05 23:53:13 +02:00
9155e8a9b4 more code coverage with Istanbul 2012-12-01 23:03:31 +02:00
5485010269 'use strict' motherfucker! do you use it?! 2012-11-27 22:51:31 +02:00
aa10a8b5de lib/svgo/ 2012-11-09 14:21:06 +02:00
7e3e4a5b01 config.json -> config.yml (close #34) 2012-11-08 16:55:30 +02:00
4c21bba984 q@0.8.10 compatibility: 'end is deprecated, use done instead' 2012-11-08 16:38:52 +02:00
acbaa170ee Istanbul code coverage 2012-11-05 12:14:38 +02:00
5444b4f234 allow any plugin of any type to go in any order (close #14) 2012-10-28 00:28:50 +03:00
6d62e8b826 JSHint :-| 2012-10-12 22:40:30 +03:00
027a88957c .svgo -> config.json 2012-10-10 12:34:06 +03:00
f0f4a48b33 test/ completely revised; every plugin now has at least one test 2012-10-03 18:15:05 +03:00