Skip to content

Commit

Permalink
chore: optimize svgos for inline html usage
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco committed May 18, 2024
1 parent f2fa6c8 commit 1277866
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const { themes } = require('prism-react-renderer');
/**
* Config for Docusaurus.
*
* $.tagline is undefined, as our copy is specified in the code instead.
* $.themeConfig.navbar.logo is undefined as this is configured with a custom component.
* $.themeConfig.footer.style is ignored as this is overriden with custom CSS.
* $.themeConfig.footer.style is ignored as this is overridden with custom CSS.
*
* @type {Config}
*/
const config = {
title: "SVGO",
tagline: "A Node.js library and command-line application to optimize vectors.",
favicon: "img/favicon.ico",
url: "https://svgo.dev",
baseUrl: "/",
Expand All @@ -32,7 +32,7 @@ const config = {
i18n: {
defaultLocale: "en",
locales: [
"en"
"en"
],
},
markdown: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function Home() {
return (
<Layout>
<Head>
<meta name="description" content="SVGO is a Node.js library and command-line application to optimize vectors."/>
<meta name="description" content="SVGO is a Node.js library and command-line application for optimizing vectors."/>
</Head>
<HomepageHeader />
<main>
Expand Down
34 changes: 27 additions & 7 deletions src/plugins/configure-svgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,33 @@ function configureSvgo() {
});

const svgoConfig = rule.oneOf[0].use[0].options.svgoConfig;
svgoConfig.plugins.push({
name: "prefixIds",
params: {
delim: "",
prefix: (_, info) => path.parse(info.path).name
}
});
svgoConfig.plugins = [
{
...svgoConfig.plugins[0],
params: {
overrides: {
...svgoConfig.plugins[0].params.overrides,
mergePaths: {
noSpaceAfterFlags: true
}
}
}
},
{
name: "prefixIds",
params: {
delim: "",
prefix: (_, info) => path.parse(info.path).name
}
},
{
name: "removeXlink",
params: {
includeLegacy: true
}
},
"removeXMLNS"
];

return {
mergeStrategy: {
Expand Down
6 changes: 3 additions & 3 deletions src/vectors/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/vectors/svgo_hackerman.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/vectors/svgo_integrations.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/vectors/svgo_oss.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/vectors/svgo_trixie.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1277866

Please sign in to comment.