Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3f7a84

Browse files
committed
create script to map fonts
1 parentdee6684 commite3f7a84

20 files changed

+399
-98
lines changed

‎package-lock.json

Lines changed: 329 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build":"rm -rf build && npm run build:ext && npm run build:web",
2121
"build:ext":"tsc -p ./",
2222
"build:web":"cd web-app && npm run build",
23-
"postbuild:web":"cp -R ./web-app/build/ ./build/",
23+
"postbuild:web":"cp -R ./web-app/build/ ./build/ && node scripts/fixFontPaths.js",
2424
"postinstall":"node ./node_modules/vscode/bin/install",
2525
"lint":"eslint src/**/*ts",
2626
"machine":"node ./out/state/index.js",
@@ -50,8 +50,10 @@
5050
"eslint":"^6.8.0",
5151
"eslint-config-prettier":"^6.10.0",
5252
"eslint-plugin-prettier":"^3.1.2",
53+
"glob":"^7.1.6",
5354
"graphql":"^14.6.0",
5455
"prettier":"^1.19.1",
56+
"resolve-url-loader":"^3.1.1",
5557
"ts-jest":"^25.1.0",
5658
"typescript":"^3.7.5",
5759
"vscode":"^1.1.36",

‎resources/public/favicon.ico

-3.78 KB
Binary file not shown.

‎resources/public/index.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎resources/public/manifest.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎scripts/fixFontPaths.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* css url font paths do not match up from the web-app as it is moved inside of build
3+
* in order to load fonts and icons, these paths must be reconciled.
4+
*/
5+
constfs=require('fs')// eslint-disable-line
6+
7+
// find the generated main css file
8+
constgetMainCSSFile=()=>{
9+
constregex=/^main.[a-z0-9]+.chunk.css$/
10+
constmainCss=fs.readdirSync('build/static/css').filter(filename=>filename.match(regex))
11+
if(!mainCss.length){
12+
thrownewError('No main.css file found in build/static/css')
13+
}
14+
returnmainCss[0]
15+
}
16+
17+
// remap the font paths from the borken /fonts/ => ../../fonts/
18+
constremapFontPaths=()=>{
19+
constmainCSSFile=getMainCSSFile()
20+
constfile=fs.readFileSync(`build/static/css/${mainCSSFile}`,'utf8')
21+
constfontUrlRegex=/url\(\/fonts\//g
22+
constremappedFile=file.replace(fontUrlRegex,'url(../../fonts/')
23+
fs.writeFileSync(`build/static/css/${mainCSSFile}`,remappedFile)
24+
}
25+
26+
remapFontPaths()

‎tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
"allowJs":true,
2626
"removeComments":true
2727
},
28-
"exclude": ["node_modules",".vscode-test","build","resources","web-app","*.js","*.test.ts"]
28+
"exclude": ["node_modules",".vscode-test","build","resources","web-app","*.js","*.test.ts","scripts"]
2929
}

‎web-app/.storybook/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{configure}from'@storybook/react'
2-
import'../src/styles/index.scss'
2+
import'../src/styles/index.css'
33

44
// setup acquireVsCodeApi mock
55
//@ts-ignore

‎web-app/src/containers/LoadingPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react'
22
import*asTfrom'typings'
33
import{css,jsx}from'@emotion/core'
44
importLoadingfrom'../components/Loading'
5-
import{Icon}from'@alifd/next'
65
importMessagefrom'../components/Message'
76

87
interfaceProps{
@@ -32,7 +31,6 @@ const LoadingPage = ({ text, context }: Props) => {
3231
}
3332
return(
3433
<divcss={styles.page}>
35-
<Icontype="smile"/>
3634
<Loadingtext={text}/>
3735
</div>
3836
)

‎web-app/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import App from './App'
55
// init error logging
66
import'./services/sentry/init'
77
// init initial styles
8-
import'./styles/index.scss'
8+
import'./styles/index.css'
99
// init listeners
1010
import'./services/listeners'
1111

‎web-app/src/styles/font.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@charset"UTF-8";
2+
3+
@font-face {
4+
font-family:'NextIcon';
5+
src:url('~resources/fonts/next-icon.woff2')format('woff2'),
6+
url('~resources/fonts/next-icon.svg#NextIcon')format('svg');
7+
}
8+
@font-face {
9+
font-family:'Roboto';
10+
src:url('~resources/fonts/roboto-thin.woff2')format('woff2');
11+
font-weight:200;
12+
}
13+
14+
@font-face {
15+
font-family:'Roboto';
16+
src:url('~resources/fonts/roboto-light.woff2')format('woff2');
17+
font-weight:300;
18+
}
19+
20+
@font-face {
21+
font-family:'Roboto';
22+
src:url('~resources/fonts/roboto-regular.woff2')format('woff2');
23+
font-weight:400;
24+
}
25+
26+
@font-face {
27+
font-family:'Roboto';
28+
src:url('~resources/fonts/roboto-medium.woff2')format('woff2');
29+
font-weight:500;
30+
}
31+
32+
@font-face {
33+
font-family:'Roboto';
34+
src:url('~resources/fonts/roboto-bold.woff2')format('woff2');
35+
font-weight:700;
36+
}

‎web-app/src/styles/font.scss

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎web-app/src/styles/index.scssrenamed to‎web-app/src/styles/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@import'~@alifd/next/index.scss';
1+
@import'~@alifd/next/dist/next.min.css';
22
/* @import '~@alifd/theme-4/dist/next.css'; */
3-
@import'./font.scss';
3+
@import'./font.css';
44

55
html {
66
height:100%;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp