From 3e1f2b0d9ddf29f23cfa4df67e5d63089366a408 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 21 Oct 2022 21:20:51 -0700 Subject: [PATCH] set svgmin option (#20923) * disable removeViewBox option * add comment --- build/lib/optimize.js | 8 +++++++- build/lib/optimize.ts | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/build/lib/optimize.js b/build/lib/optimize.js index dee90b3d32..dfc644dfed 100644 --- a/build/lib/optimize.js +++ b/build/lib/optimize.js @@ -199,7 +199,13 @@ function minifyTask(src, sourceMapBaseUrl) { f.sourceMap = JSON.parse(sourceMapFile.text); cb(undefined, f); }, cb); - }), jsFilter.restore, cssFilter, postcss([cssnano({ preset: 'default' })]), cssFilter.restore, svgFilter, svgmin(), svgFilter.restore, sourcemaps.mapSources((sourcePath) => { + }), jsFilter.restore, cssFilter, postcss([cssnano({ preset: 'default' })]), cssFilter.restore, svgFilter, + // {{SQL CARBON EDIT}} - Disable the removeViewBox option because some SVG files ADS needs will not scale properly when the view box information is removed. + svgmin({ + plugins: [ + { removeViewBox: false } + ] + }), svgFilter.restore, sourcemaps.mapSources((sourcePath) => { if (sourcePath === 'bootstrap-fork.js') { return 'bootstrap-fork.orig.js'; } diff --git a/build/lib/optimize.ts b/build/lib/optimize.ts index 0451450af4..cfda628c34 100644 --- a/build/lib/optimize.ts +++ b/build/lib/optimize.ts @@ -288,7 +288,12 @@ export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => postcss([cssnano({ preset: 'default' })]), cssFilter.restore, svgFilter, - svgmin(), + // {{SQL CARBON EDIT}} - Disable the removeViewBox option because some SVG files ADS needs will not scale properly when the view box information is removed. + svgmin({ + plugins: [ + { removeViewBox: false } + ] + }), svgFilter.restore, (sourcemaps).mapSources((sourcePath: string) => { if (sourcePath === 'bootstrap-fork.js') {