Skip to content

Commit

Permalink
deps: update to svgo v3.0.5 and update docs (#1533)
Browse files Browse the repository at this point in the history
* chore: drop stickermule link

* chore: add name to contributors

* docs: update config to svgo v3 syntax

* chore: use plugin type from svgo

* deps: update to svgo v3.0.5
  • Loading branch information
SethFalco committed Dec 6, 2023
1 parent 8eb75bf commit e24cbee
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ Thanks goes to these wonderful people:
- James George
- Jordy D'Hoker
- Xiaojun Zhou
- Seth Falco

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions packages/postcss-svgo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,26 @@ below. Note that you can either disable the plugin by setting it to `false`,
or pass different options to change the default behaviour.

```js
var postcss = require('postcss');
var svgo = require('postcss-svgo');
const postcss = require('postcss');
const svgo = require('postcss-svgo');

var opts = {
const opts = {
plugins: [{
removeDoctype: false
}, {
removeComments: false
}, {
cleanupNumericValues: {
floatPrecision: 2
}
}, {
convertColors: {
names2hex: false,
rgb2hex: false
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
removeComments: false,
cleanupNumericValues: {
floatPrecision: 2
}
}
}
}]
};

postcss([ svgo(opts) ]).process(css).then(function (result) {

postcss([ svgo(opts) ]).process(css).then((result) => {
console.log(result.css)
});
```
Expand All @@ -107,4 +106,4 @@ See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTOR
MIT © [Ben Briggs](http://beneb.info)

[postcss]: https://github.com/postcss/postcss
[plugins]: https://github.com/svg/svgo/tree/master/plugins
[plugins]: https://svgo.dev/docs/plugins/
2 changes: 1 addition & 1 deletion packages/postcss-svgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"repository": "cssnano/cssnano",
"dependencies": {
"postcss-value-parser": "^4.2.0",
"svgo": "^3.0.2"
"svgo": "^3.0.5"
},
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-svgo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function minify(decl, opts, postcssResult) {

decl.value = minified.toString();
}
/** @typedef {{encode?: boolean, plugins?: object[]} & import('svgo').Config} Options */
/** @typedef {{encode?: boolean} & import('svgo').Config} Options */
/**
* @type {import('postcss').PluginCreator<Options>}
* @param {Options} opts
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-svgo/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test(
'should not throw when decoding a svg',
processCSS(
"h1{-webkit-mask-box-image: url(\"data:image/svg+xml;charset=utf-8,<svg height='35' viewBox='0 0 96 70' width='48' xmlns='http://www.w3.org/2000/svg'><path d='m84 35c1 7-5 37-42 35-37 2-43-28-42-35-1-7 5-37 42-35 37-2 43 28 42 35z'/></svg>\") 50% 56% 46% 42%;}",
'h1{-webkit-mask-box-image: url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="35" viewBox="0 0 96 70"><path d="M84 35c1 7-5 37-42 35C5 72-1 42 0 35-1 28 5-2 42 0c37-2 43 28 42 35z"/></svg>\') 50% 56% 46% 42%;}'
'h1{-webkit-mask-box-image: url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="35" viewBox="0 0 96 70"><path d="M84 35c1 7-5 37-42 35C5 72-1 42 0 35-1 28 5-2 42 0c37-2 43 28 42 35"/></svg>\') 50% 56% 46% 42%;}'
)
);

Expand Down
3 changes: 1 addition & 2 deletions packages/postcss-svgo/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export = pluginCreator;
/** @typedef {{encode?: boolean, plugins?: object[]} & import('svgo').Config} Options */
/** @typedef {{encode?: boolean} & import('svgo').Config} Options */
/**
* @type {import('postcss').PluginCreator<Options>}
* @param {Options} opts
Expand All @@ -11,7 +11,6 @@ declare namespace pluginCreator {
}
type Options = {
encode?: boolean;
plugins?: object[];
} & import('svgo').Config;
declare var postcss: true;
import { encode } from "./lib/url";
9 changes: 5 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion site/src/docs/presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ module.exports = {
preset: ['default', {
svgo: {
plugins: [{
removeDoctype: false,
name: 'preset-default',
params: {
overrides: {
removeDoctype: false,
},
},
}],
},
}],
Expand Down
4 changes: 0 additions & 4 deletions site/src/docs/support-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@ A huge THANK YOU to our recurring backers!
A huge THANK YOU to our backers!

<object type="image/svg+xml" data="https://opencollective.com/cssnano/backers.svg?avatarHeight=36&width=600"></object>

## Stickers

We sell logo stickers through [StickerMule](https://www.stickermule.com/uk/marketplace/11086-cssnano).

0 comments on commit e24cbee

Please sign in to comment.