1
0
mirror of https://github.com/svg/svgo.git synced 2025-04-19 10:22:15 +03:00

19 Commits

Author SHA1 Message Date
Bogdan Chadkin
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
XhmikosR
21d24006fd
Remove the executable flag from files. (#1439) 2021-03-20 20:46:26 +03:00
Bogdan Chadkin
6f2f62c5ee
Access attributes directly (#1433)
Got rid from `.attrs`, `.attr()` and `.addAttr()` usages
2021-03-18 18:53:20 +03:00
Bogdan Chadkin
5314c12c99 Convert element children to xast
Ref https://github.com/syntax-tree/xast

Renamed content to children to match xast spec.
2021-03-11 12:29:13 +03:00
Bogdan Chadkin
e82a672bbf Prepare root and element nodes for xast
Ref https://github.com/syntax-tree/xast

- added type: root | element
- renamed elem to name
- replaced "elem" property checks with check for correct type
2021-03-10 18:49:26 +03:00
Bogdan Chadkin
c50decb438 Convert cdata and text nodes to xast
Ref https://github.com/syntax-tree/xast

More consistent naming and distinction by type looks a bit cleaner.
2021-03-10 16:16:11 +03:00
Bogdan Chadkin
00ec0f71fe Format all plugins with prettier 2021-03-09 19:58:00 +03:00
Bogdan Chadkin
a7cc20bb43
Setup recommended eslint preset (#1345)
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
2021-02-19 15:26:07 +03:00
Bogdan Chadkin
d273b26605
Provide es module bundle for browser (#1326)
The was a lot of requests to provide browser compatible module. In this
diff I added `svgo/dist/svgo.browser.js` bundle and tested it with
playwright.
2021-02-16 19:11:01 +03:00
Bogdan Chadkin
70d1f2b2f8 Upgrade css-tree and csso 2021-02-16 18:14:10 +03:00
Sviatoslav Bulbakha
fafcbd7bd0 Fix prefixIds plugin error with animations
Fix #848
2019-11-08 18:36:45 +03:00
strarsis
71c7fe74b9 Add multipassCount to info object passed to the plugins.
Use info object to skip subsequent passes in prefixIds plugin to prevent unintended, multiple prefixing.
2019-10-29 22:50:59 +03:00
strarsis
5ee68c4808 Add options to prefixIds plugin for selectively prefixing IDs and/or classes. 2019-07-13 22:51:06 +03:00
GreLI
9fe7c28a81 Bump dependencies 2019-07-13 22:10:10 +03:00
Stephanie Miller
e7b8a6ce7d Upgrade css-tree from alpha25 to alpha.28
API changed walkFoo(ast, fun) to walk(ast,{visit: 'Rule',enter: fun)
csstree.translate renamed to csstree.generate
csstree.generate throws an error on invalid style where translate silently ignored it - update style processing to catch and ignore instead
Updated tests - csstree now omits more whitespace
2018-09-15 14:43:28 +03:00
Vitali Zaidman
9dd1802a0d fixed #948 - adds prefixes to each class individually (#950) 2018-04-24 15:39:59 +03:00
Vitali Zaidman
0a142f3ca0 Prefix ids plugin don't add prefix if prefix is false (#907)
Add to 'prefixIds' the option to pass prefix as false or as a function that returns false
2018-03-16 20:39:21 +03:00
Harris P Jose
40987c9643 Fix issue with prefixIDs plugin not replacing url() values correctly
Global regexs must be reseted after every exec call since they preserve the last matched index. Since we use `css-url-regex`, creating a new regex before `exec`ing fixes this.
2018-02-19 10:56:57 +05:30
strarsis
91d98106d4 Add prefixIds plugin (#700)
Add prefixIds plugin
2017-10-23 22:14:43 +03:00