Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ConductionNL/woo-website-template
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Apr 17, 2024
2 parents 3fb030a + 82cf1b5 commit f19b785
Show file tree
Hide file tree
Showing 46 changed files with 2,361 additions and 4,052 deletions.
70 changes: 69 additions & 1 deletion pwa/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.onCreateBabelConfig = ({ actions }) => {
});
};

exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
exports.onCreateWebpackConfig = ({ stage, actions, getConfig, plugins }) => {
if (stage === "develop" || stage === "build-javascript") {
const config = getConfig();
const miniCssExtractPlugin = config.plugins.find(
Expand All @@ -16,6 +16,74 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
if (miniCssExtractPlugin) {
miniCssExtractPlugin.options.ignoreOrder = true;
}

const options = {
minimizerOptions: {
preset: [
`default`,
{
svgo: {
full: true,
plugins: [
// potentially destructive plugins removed - see https://github.com/gatsbyjs/gatsby/issues/15629
// use correct config format and remove plugins requiring specific params - see https://github.com/gatsbyjs/gatsby/issues/31619
`removeUselessDefs`,
`cleanupAttrs`,
`cleanupEnableBackground`,
`cleanupIDs`,
`cleanupListOfValues`,
`cleanupNumericValues`,
`collapseGroups`,
`convertColors`,
`convertPathData`,
`convertStyleToAttrs`,
`convertTransform`,
`inlineStyles`,
`mergePaths`,
`minifyStyles`,
`moveElemsAttrsToGroup`,
`moveGroupAttrsToElems`,
`prefixIds`,
`removeAttrs`,
`removeComments`,
`removeDesc`,
`removeDimensions`,
`removeDoctype`,
`removeEditorsNSData`,
`removeEmptyAttrs`,
`removeEmptyContainers`,
`removeEmptyText`,
`removeHiddenElems`,
`removeMetadata`,
`removeNonInheritableGroupAttrs`,
`removeOffCanvasPaths`,
`removeRasterImages`,
`removeScriptElement`,
`removeTitle`,
`removeUnknownsAndDefaults`,
`removeUnusedNS`,
`removeUselessStrokeAndFill`,
`removeXMLProcInst`,
`reusePaths`,
`sortAttrs`,
],
},
},
],
}
}

// find CSS minimizer
const minifyCssIndex = config.optimization.minimizer.findIndex(
minimizer => minimizer.constructor.name ===
'CssMinimizerPlugin'
)
// if found, overwrite existing CSS minimizer with the new one
if (minifyCssIndex > -1) {
config.optimization.minimizer[minifyCssIndex] =
plugins.minifyCss(options)
}

actions.replaceWebpackConfig(config);
}
};
Loading

0 comments on commit f19b785

Please sign in to comment.