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

21 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
4cacd9e676
Migrate ast traversing into xast module (#1434)
Replaced JSAPI methods with new utilities

- querySelectorAll(node, selector)
- querySelector(node, selector)
- matches(node, selector)
- closestByName(node, elementName)
- traverse(node, fn)

New traverse replaced many in-place implementations.
2021-03-19 11:06:41 +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
194058b9eb Clarify condition and add todo with new plugin 2021-03-10 16:22:37 +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
Sebastian Kreft
0394bf0ea6
refactor: replace uses of for in (#1382)
Replace the uses of `for in` with `for of` and `Object.entries`/`Object.values`/`Object.keys`.

One case was further simplified by using a spread.
2021-02-27 23:17:30 +03:00
Roman Dvornov
340da36bc7 make unused styles removal safe
- avoid using usage data when document contains <script> or on*
attributes
- implemented usage.force option to force usage data using
2017-01-12 14:56:33 +03:00
Roman Dvornov
da6a40da7f merge removeUnusedStyles plugin with minifyStyles 2017-01-12 14:32:47 +03:00
GreLI
df6f48210e Corrected CSSO API usage 2016-04-25 14:28:15 +03:00
Roman Dvornov
df9cd399c0 bump csso to 1.8.0 and use minifyBlock for style attribute content compression 2016-03-24 21:57:43 +03:00
GreLI
215cd39c22 minifyStyles: preserve CDATA if needed 2016-03-08 20:35:00 +03:00
GreLI
fc174aa9f0 Fixed error on empty or CDATA styles. Fixed #455. Fixes #456 2015-11-21 13:00:31 +03:00
GreLI
da5107abd8 MinifyStyles: unix line-endings 2015-11-21 12:58:15 +03:00
strarsis
01d003b024 Fix regression. 2015-11-02 16:10:45 +01:00
strarsis
e5c6cd42c5 Improve indentation. 2015-11-02 15:35:12 +01:00
strarsis
dbf30dd59f Add missing option argument to csso minify. 2015-11-02 00:40:36 +01:00
strarsis
16ea8c8057 Add minifyStyles plugin, test and dependencies. 2015-11-02 00:32:23 +01:00