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

30 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
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
07928fc77e
Replace removeAttr with delete operator (#1432)
delete operator is more explicit and not much harder to use.
2021-03-17 21:40:06 +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
d1d6e5efe8
Remove prefix/local support in elements and attributes (#1413)
These parts of element and attribute name are easy to extract.
Now we can easily replace attrs with xast attributes object.
2021-03-10 13:26:15 +03:00
Bogdan Chadkin
00ec0f71fe Format all plugins with prettier 2021-03-09 19:58:00 +03:00
Bogdan Chadkin
a1fcd034fe
Disable convertStyleToAttrs plugin by default (#1365)
Ref https://github.com/svg/svgo/issues/1362 https://github.com/svg/svgo/issues/1360

From the [spec](https://www.w3.org/TR/SVG11/styling.html#UsingPresentationAttributes):

> Presentation attributes have lower priority than other CSS style rules specified in author style sheets or ‘style’ attributes.

Though we replace inline styles with attributes without checking if
thare is any `<style>` element. This makes the plugin unsafe and it
should not be enabled by default.
2021-02-23 00:28:09 +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
XhmikosR
136a52cdb6
convertStyleToAttrs: fix wrong character class (#1338) 2021-02-19 02:30:05 +03:00
GreLI
86ecd372e7 Handle !important keyword in convertStyleToAttrs
Fix #749
2018-09-15 15:15:11 +03:00
Vasiliy Loginevskiy
4495a34f55 Remove unnecessary dependency 2017-03-22 09:03:51 +03:00
GreLI
2f88a38730 Use presentation attibures instead of all styling properties.
Fixes #528
2016-04-05 17:29:05 +03:00
David
cdd44ce557 Fixed typo in the JSDoc block of plugins/convertStyleToAttrs.js 2015-12-27 17:31:30 -08:00
GreLI
a7f62d8984 Formatting 2015-06-21 19:13:41 +03:00
Yoshiya Hinosawa
73c5a73900 Modify jshint rules 2015-06-13 18:32:19 +09:00
Yoshiya Hinosawa
3f8e6fd15c Fix lint 2015-06-12 00:25:32 +09:00
Yoshiya Hinosawa
8e6b365c40 Add --show-plugins option 2015-06-07 19:35:49 +09:00
GreLI
15e303bbf0 Convert colors now takes fractional percentages and minor improvements.
Fixes #175 and resolves #178.
2015-03-22 18:45:46 +03:00
GreLI
1e81329982 Non greedy comments regexp 2015-02-23 17:52:53 +03:00
GreLI
84fd2720ca Get rid of strut 2015-02-23 17:36:10 +03:00
GreLI
73f7f3c183 Improved code for parsing CSS in attributes values 2015-02-23 17:29:23 +03:00
GreLI
942d2f74fa Better css parsing in style attr. Fixes #227 2015-02-08 22:33:24 +03:00
deepsweet
578cf60f1d node.extend -> whet.extend 2013-04-10 14:48:07 +03:00
deepsweet
2816424ed7 global refactoring dump 2013-04-09 22:06:27 +03:00
deepsweet
5485010269 'use strict' motherfucker! do you use it?! 2012-11-27 22:51:31 +02:00
deepsweet
bb6323c7f8 more JSHint 2012-11-27 16:53:05 +02:00
deepsweet
aa10a8b5de lib/svgo/ 2012-11-09 14:21:06 +02:00
deepsweet
291631509f lib/jsAPI: simplification and refactoring 2012-10-15 08:28:25 +03:00
deepsweet
9ac9c191d4 plugins/convertStyleToAttrs: cleanup style attr 2012-10-02 13:46:54 +04:00
deepsweet
13af2ed95e go! 2012-09-27 14:06:28 +03:00