summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-05 11:09:09 +0100
committerGitHub <noreply@github.com>2020-12-05 12:09:09 +0200
commit61d6c191d5852703048218e047d367f91533c517 (patch)
treec4c0cbe5c0a8b78b01863313259f963b5274851f /build
parent1a768e547c076f21338b84e7cd74a3f967e9156c (diff)
downloadgitea-61d6c191d5852703048218e047d367f91533c517.tar.gz
gitea-61d6c191d5852703048218e047d367f91533c517.zip
Improve migrate page and add card CSS (#13751)
- Use original gitea logo on migrate page - Add card styles and map colors to css vars - Tweak migrate page, adding hover effect to cards Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/generate-svg.js30
1 files changed, 19 insertions, 11 deletions
diff --git a/build/generate-svg.js b/build/generate-svg.js
index 96a4f5fadb..52d2c519ef 100755
--- a/build/generate-svg.js
+++ b/build/generate-svg.js
@@ -14,10 +14,16 @@ function exit(err) {
process.exit(err ? 1 : 0);
}
-async function processFile(file, {prefix = ''} = {}) {
- let name = parse(file).name;
- if (prefix) name = `${prefix}-${name}`;
- if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
+async function processFile(file, {prefix, fullName} = {}) {
+ let name;
+
+ if (fullName) {
+ name = fullName;
+ } else {
+ name = parse(file).name;
+ if (prefix) name = `${prefix}-${name}`;
+ if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
+ }
const svgo = new Svgo({
plugins: [
@@ -47,18 +53,20 @@ async function processFile(file, {prefix = ''} = {}) {
await writeFile(resolve(outputDir, `${name}.svg`), data);
}
+function processFiles(pattern, opts) {
+ return glob(pattern).map((file) => processFile(file, opts));
+}
+
async function main() {
try {
await mkdir(outputDir);
} catch {}
- for (const file of glob('../node_modules/@primer/octicons/build/svg/*-16.svg')) {
- await processFile(file, {prefix: 'octicon'});
- }
-
- for (const file of glob('../web_src/svg/*.svg')) {
- await processFile(file);
- }
+ await Promise.all([
+ ...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
+ ...processFiles('../web_src/svg/*.svg'),
+ ...processFiles('../assets/logo.svg', {fullName: 'gitea-gitea'}),
+ ]);
}
main().then(exit).catch(exit);