Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Unreleased
- Dependencies: Update various dependencies (#5877)
- Maintenance: Enable stricter Changelog checks in continuous integration (#5882)
- Logging: Fix logging of transport attribute in RISC event delivery (#5881)
- Security: Update JavaScript packages with known vulnerabilities (#5889)

RC 175.2 - 2022-01-29
----------------------
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ normalize_yaml: ## Normalizes YAML files (alphabetizes keys, fixes line length,
optimize_svg: ## Optimizes SVG images
# Without disabling minifyStyles, keyframes are removed (e.g. `app/assets/images/id-card.svg`).
# See: https://github.com/svg/svgo/issues/888
find app/assets/images public -name '*.svg' -not -name 'sprite.svg' | xargs ./node_modules/.bin/svgo --multipass --disable minifyStyles --disable=removeViewBox --config '{"plugins":[{"removeAttrs":{"attrs":"data-name"}}]}'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall having an in-progress branch somewhere with the SVGO upgrade, and it requires some alternative to the (now-deprecated) flags here, through a config file. Let me see if I can dig that up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I forgot to include what I had for the file! Added it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I forgot to include what I had for the file! Added it

Gotcha 👍 Mine included the "default preset" and modified a few of the defaults from there, but if it can be done at the top-level like you have, I think that works better.

module.exports = {
  multipass: true,
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          minifyStyles: false,
          removeViewBox: false,
        },
      },
    },
    {
      name: 'removeAttrs',
      params: {
        attrs: 'data-name',
      },
    },
  ],
};

find app/assets/images public -name '*.svg' -not -name 'sprite.svg' | xargs ./node_modules/.bin/svgo

optimize_assets: optimize_svg ## Optimizes all assets

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@testing-library/user-event": "^12.6.0",
"@types/chai": "^4.2.22",
"@types/dirty-chai": "^2.0.2",
"@types/mocha": "^9.0.0",
"@types/mocha": "^9.1.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/sinon": "^9.0.11",
Expand All @@ -62,16 +62,16 @@
"clipboard-polyfill": "^3.0.3",
"dirty-chai": "^2.0.1",
"eslint": "^8.3.0",
"jsdom": "^16.4.0",
"mocha": "^8.2.1",
"jsdom": "^19.0.0",
"mocha": "^9.1.0",
"mq-polyfill": "^1.1.8",
"postcss": "^8.4.5",
"prettier": "^2.2.1",
"react-test-renderer": "^17.0.2",
"sinon": "^9.2.2",
"sinon-chai": "^3.5.0",
"stylelint": "^14.1.0",
"svgo": "^1.3.2",
"svgo": "^2.8.0",
"typescript": "^4.1.3",
"webpack-dev-server": "^4.7.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('document-capture/hooks/use-async', () => {
.returns(
new Promise((_resolve, _reject) => {
reject = () => {
_reject();
_reject(new Error());
};
}),
)
Expand Down
13 changes: 13 additions & 0 deletions svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
multipass: true,
minifyStyles: false,
removeViewBox: false,
plugins: [
{
name: 'removeAttrs',
params: {
attrs: 'data-name',
},
},
],
};
Loading