From 0c344a048a947f2324bccaa882d6e8a88721a4f8 Mon Sep 17 00:00:00 2001 From: notgne2 Date: Thu, 13 Feb 2020 21:15:03 -0700 Subject: [PATCH] fix some dumb issues --- default.nix | 6 ++--- webpack.config.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index 60443c3..46e8750 100644 --- a/default.nix +++ b/default.nix @@ -164,6 +164,9 @@ let patchPhase = '' ln -sf ${nodeSource}/node_modules . + rm -f webpack.config.js + rm -f wand.js + rm -f template.html cp ${webpackConfigFile} webpack.config.js cp ${wandInit} wand.js cp ${templateHtml} template.html @@ -171,11 +174,8 @@ let shellHook = '' ln -sf ${nodeSource}/node_modules . - rm webpack.config.js cp ${webpackConfigFile} webpack.config.js - rm wand.js cp ${wandInit} wand.js - rm template.html cp ${templateHtml} template.html export NODE_PATH=$PWD/node_modules ''; diff --git a/webpack.config.js b/webpack.config.js index a385c0c..6aa1a03 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -78,6 +78,9 @@ prerenderOpts = (width, height, name) => ({ module.exports = { target: 'web', + externals: { + svgo: 'svgo' + }, entry: magicFile(` if ('serviceWorker' in navigator) { window.addEventListener('load', () => navigator.serviceWorker.register('/sw.js')); @@ -121,6 +124,61 @@ module.exports = { new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]), new ImageminPlugin({ jpegtran: { progressive: true }, + svgo: null, + // svgo: { + // full: true, + // plugins: [ + // { 'removeDoctype': { className: 'removeDoctype', attributes: [] } }, + // { 'removeXMLProcInst': { className: 'removeXMLProcInst', attributes: [] } }, + // { 'removeComments': { className: 'removeComments', attributes: [] } }, + // { 'removeMetadata': { className: 'removeMetadata', attributes: [] } }, + // { 'removeXMLNS': { className: 'removeXMLNS', attributes: [] } }, + // { 'removeEditorsNSData': { className: 'removeEditorsNSData', attributes: [] } }, + // { 'cleanupAttrs': { className: 'cleanupAttrs', attributes: [] } }, + // { 'inlineStyles': { className: 'inlineStyles', attributes: [] } }, + // { 'minifyStyles': { className: 'minifyStyles', attributes: [] } }, + // { 'convertStyleToAttrs': { className: 'convertStyleToAttrs', attributes: [] } }, + // { 'cleanupIDs': { className: 'cleanupIDs', attributes: [] } }, + // { 'prefixIds': { className: 'prefixIds', attributes: [] } }, + // { 'removeRasterImages': { className: 'removeRasterImages', attributes: [] } }, + // { 'removeUselessDefs': { className: 'removeUselessDefs', attributes: [] } }, + // { 'cleanupNumericValues': { className: 'cleanupNumericValues', attributes: [] } }, + // { 'cleanupListOfValues': { className: 'cleanupListOfValues', attributes: [] } }, + // { 'convertColors': { className: 'convertColors', attributes: [] } }, + // { 'removeUnknownsAndDefaults': { className: 'removeUnknownsAndDefaults', attributes: [] } }, + // { 'removeNonInheritableGroupAttrs': { className: 'removeNonInheritableGroupAttrs', attributes: [] } }, + // { 'removeUselessStrokeAndFill': { className: 'removeUselessStrokeAndFill', attributes: [] } }, + // { 'removeViewBox': { className: 'removeViewBox', attributes: [] } }, + // { 'cleanupEnableBackground': { className: 'cleanupEnableBackground', attributes: [] } }, + // { 'removeHiddenElems': { className: 'removeHiddenElems', attributes: [] } }, + // { 'removeEmptyText': { className: 'removeEmptyText', attributes: [] } }, + // { 'convertShapeToPath': { className: 'convertShapeToPath', attributes: [] } }, + // { 'convertEllipseToCircle': { className: 'convertEllipseToCircle', attributes: [] } }, + // { 'moveElemsAttrsToGroup': { className: 'moveElemsAttrsToGroup', attributes: [] } }, + // { 'moveGroupAttrsToElems': { className: 'moveGroupAttrsToElems', attributes: [] } }, + // { 'collapseGroups': { className: 'collapseGroups', attributes: [] } }, + // { 'convertPathData': { className: 'convertPathData', attributes: [] } }, + // { 'convertTransform': { className: 'convertTransform', attributes: [] } }, + // { 'removeEmptyAttrs': { className: 'removeEmptyAttrs', attributes: [] } }, + // { 'removeEmptyContainers': { className: 'removeEmptyContainers', attributes: [] } }, + // { 'mergePaths': { className: 'mergePaths', attributes: [] } }, + // { 'removeUnusedNS': { className: 'removeUnusedNS', attributes: [] } }, + // { 'sortAttrs': { className: 'sortAttrs', attributes: [] } }, + // { 'sortDefsChildren': { className: 'sortDefsChildren', attributes: [] } }, + // { 'removeTitle': { className: 'removeTitle', attributes: [] } }, + // { 'removeDesc': { className: 'removeDesc', attributes: [] } }, + // { 'removeDimensions': { className: 'removeDimensions', attributes: [] } }, + // { 'removeAttrs': { className: 'removeAttrs', attributes: [] } }, + // { 'removeAttributesBySelector': { className: 'removeAttributesBySelector', attributes: [] } }, + // { 'removeElementsByAttr': { className: 'removeElementsByAttr', attributes: [] } }, + // { 'addClassesToSVGElement': { className: 'addClassesToSVGElement', attributes: [] } }, + // { 'removeStyleElement': { className: 'removeStyleElement', attributes: [] } }, + // { 'removeScriptElement': { className: 'removeScriptElement', attributes: [] } }, + // { 'addAttributesToSVGElement': { className: 'addAttributesToSVGElement', attributes: [] } }, + // { 'removeOffCanvasPaths': { className: 'removeOffCanvasPaths', attributes: [] } }, + // { 'reusePaths': { className: 'reusePaths', attributes: [] } }, + // ] + // }, }), new HtmlWebpackPlugin({ hash: true,