diff options
author | silverwind <me@silverwind.io> | 2021-03-22 05:04:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-22 05:04:19 +0100 |
commit | 1a03fa7a4f353eb2f965cdcac39f630c281eca1e (patch) | |
tree | 042e54d01f25afff9f78c38cdc3d1c2da062118f /build/generate-images.js | |
parent | a587a284349e7c27d1bec39ef0dedb3972ef68c5 (diff) | |
download | gitea-1a03fa7a4f353eb2f965cdcac39f630c281eca1e.tar.gz gitea-1a03fa7a4f353eb2f965cdcac39f630c281eca1e.zip |
Update JS dependencies (#15033)
* Update JS dependencies
- Update all JS dependencies
- For octicons, rename trashcan to trash
- For svgo, migrate to v2 api, output seems to have slightly changed but icons look the same
- For stylelint, update config, fix custom property duplicates
- For monaco, drop legacy Edge support
- For eslint, enable new rules, fix new issues
- For less-loader, remove deprecated import syntax
* update svgo usage in generate-images and rebuild logo.svg with it
Diffstat (limited to 'build/generate-images.js')
-rwxr-xr-x | build/generate-images.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/build/generate-images.js b/build/generate-images.js index c9108ce713..bea36321e3 100755 --- a/build/generate-images.js +++ b/build/generate-images.js @@ -2,7 +2,7 @@ 'use strict'; const imageminZopfli = require('imagemin-zopfli'); -const Svgo = require('svgo'); +const {optimize, extendDefaultPlugins} = require('svgo'); const {fabric} = require('fabric'); const {readFile, writeFile} = require('fs').promises; const {resolve} = require('path'); @@ -24,14 +24,15 @@ function loadSvg(svg) { async function generate(svg, outputFile, {size, bg}) { if (outputFile.endsWith('.svg')) { - const svgo = new Svgo({ - plugins: [ - {removeDimensions: true}, - {addAttributesToSVGElement: {attributes: [{width: size}, {height: size}]}}, - ], + const {data} = optimize(svg, { + plugins: extendDefaultPlugins([ + 'removeDimensions', + { + name: 'addAttributesToSVGElement', + params: {attributes: [{width: size}, {height: size}]} + }, + ]), }); - - const {data} = await svgo.optimize(svg); await writeFile(outputFile, data); return; } |