Skip to content

Commit

Permalink
chore(postcss-svgo): require the latest svgo and fix import warnings
Browse files Browse the repository at this point in the history
eslint complains an svgo import does not exist but the code works and the
import is documented, so add a comment to disable the eslint check for that
line.
  • Loading branch information
ludofischer committed Nov 4, 2021
1 parent 0426a4d commit 8ec33a1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/postcss-svgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"repository": "cssnano/cssnano",
"dependencies": {
"postcss-value-parser": "^4.1.0",
"svgo": "^2.7.0"
"svgo": "^2.8.0"
},
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
Expand Down
14 changes: 10 additions & 4 deletions packages/postcss-svgo/src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFileSync as file } from 'fs';
import postcss from 'postcss';
import filters from 'pleeease-filters';
import { extendDefaultPlugins } from 'svgo';
import plugin from '../';
import { encode, decode } from '../lib/url';
import {
Expand Down Expand Up @@ -108,9 +107,16 @@ test(
'h1{background:url(\'data:image/svg+xml;utf-8,<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><circle cx="50" cy="50" r="40" fill="yellow" /><!--test comment--></svg>\')}',
'h1{background:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve"><circle cx="50" cy="50" r="40" fill="%23ff0"/><!--test comment--></svg>\')}',
{
plugins: extendDefaultPlugins([
{ name: 'removeComments', active: false },
]),
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeComments: false,
},
},
},
],
}
)
);
Expand Down
1 change: 1 addition & 0 deletions packages/postcss-svgo/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import valueParser from 'postcss-value-parser';
/* eslint-disable import/named */
import { optimize } from 'svgo';
import { encode, decode } from './lib/url';

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7762,7 +7762,7 @@ supports-hyperlinks@^2.0.0:
has-flag "^4.0.0"
supports-color "^7.0.0"

svgo@^2.7.0:
svgo@^2.8.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.8.0.tgz#4ff80cce6710dc2795f0c7c74101e6764cfccd24"
integrity sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==
Expand Down

0 comments on commit 8ec33a1

Please sign in to comment.