1
0
mirror of https://github.com/svg/svgo.git synced 2025-09-17 08:02:12 +03:00

32 Commits

Author SHA1 Message Date
Seth Falco
747cc722d9 chore: revamp how we export types (#2118) 2025-05-04 17:39:44 +01:00
Seth Falco
4573d0178e chore: migrate plugin types to plugin (#2111) 2025-04-30 02:16:53 +01:00
Seth Falco
9c8768f64d ci: add spellcheck (#2101) 2025-04-12 16:47:32 +01:00
Nathan Baulch
0eccff2794 chore: fix various typos across the project 2025-03-22 11:49:01 +00:00
Jon Dufresne
2442f74239 chore: convert project to us ECMAScript modules (preserving CJS compatibility) (#1905) 2024-01-03 16:17:37 +00:00
Seth Falco
c2cacc7060 chore: move health files to .github (#1906) 2023-12-27 12:54:30 +00:00
Seth Falco
3966c10565 refactor: create hasScripts util (#1809)
Introduces a hasScript utility which can be reused to consistently check for scripts, whereas before different plugins performed this check differently.
2023-10-22 10:58:03 +01:00
Seth Falco
b15da27af4 fix(minifyStyles): pass empty arrays for usage (#1800) 2023-09-25 23:13:54 +01:00
Bogdan Chadkin
e2e65cfc1e Move plugin types into d.ts 2022-11-11 12:19:38 +03:00
Bogdan Chadkin
e6bd703b0a Remove unused active and type fields from plugins 2022-10-08 23:39:58 +03:00
Bogdan Chadkin
107922405a Refactor minifyStyles plugin (#1552)
- migrated to visitor plugin api
- covered with types
- get rid from "traverse" usage

Splitted the work to collecting and modifying when root exit.
2021-09-05 17:35:11 +03:00
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