Skip to content

Commit

Permalink
fix: store font files locally
Browse files Browse the repository at this point in the history
address LN-Zap#2984
  • Loading branch information
bolatovumar committed Oct 18, 2019
1 parent 00077c9 commit 4fee821
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 25 deletions.
Binary file added fonts/roboto-light.woff2
Binary file not shown.
Binary file added fonts/roboto-regular.woff2
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
"eslint-import-resolver-webpack": "0.11.1",
"extract-react-intl-messages": "2.3.3",
"fake-indexeddb": "2.1.1",
"file-loader": "4.2.0",
"gh-pages": "2.1.1",
"html-webpack-plugin": "3.2.0",
"husky": "3.0.9",
Expand Down
14 changes: 7 additions & 7 deletions renderer/components/UI/GlobalStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@ import { createGlobalStyle } from 'styled-components'
import { themeGet } from '@styled-system/theme-get'
import reset from 'styled-reset'
import { rgba } from 'polished'
import RobotoLight from '@zap/fonts/roboto-light.woff2'
import RobotoRegular from '@zap/fonts/roboto-regular.woff2'

/* eslint-disable max-len */
const GlobalStyle = createGlobalStyle`
/* stylelint-disable font-family-no-missing-generic-family-keyword */
${reset}
@font-face {
font-family: 'Roboto';
font-family: 'Robotokek';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmSU5fBBc4AMP6lQ.woff2) format('woff2');
src: local('Roboto Light'), local('Roboto-Light'), url('${RobotoLight}') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
font-family: 'Roboto';
font-family: 'Robotokek';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2) format('woff2');
src: local('Roboto'), local('Roboto-Regular'), url('${RobotoRegular}') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
Expand All @@ -38,7 +40,7 @@ const GlobalStyle = createGlobalStyle`
overflow: hidden;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
font-family: 'Roboto', Arial, Helvetica, sans-serif;
font-family: 'Robotokek', Arial, Helvetica, sans-serif;
font-weight: 300;
font-size: 13px;
}
Expand Down Expand Up @@ -256,8 +258,6 @@ const GlobalStyle = createGlobalStyle`
transform: rotate(360deg);
}
}
`

export default GlobalStyle
8 changes: 1 addition & 7 deletions webpack/dev/renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,7 @@ const config = merge.smart(baseConfig, {
],
'img-src': ['http://resources.zaphq.io', 'data:'],
'script-src': ["'self'", 'http://localhost:*', "'unsafe-eval'"],
'font-src': [
"'self'",
'data:',
'http://localhost:*',
'https://s3.amazonaws.com',
'https://fonts.gstatic.com',
],
'font-src': ["'self'", 'data:', 'http://localhost:*', 'https://s3.amazonaws.com'],
'style-src': ["'self'", 'blob:', 'https://s3.amazonaws.com', "'unsafe-inline'"],
}),
new webpack.DllReferencePlugin({
Expand Down
2 changes: 1 addition & 1 deletion webpack/prod/renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const config = merge.smart(baseConfig, {
],
'img-src': ['http://resources.zaphq.io', 'data:'],
'script-src': ["'self'", "'unsafe-eval'"],
'font-src': ["'self'", 'data:', 'https://s3.amazonaws.com', 'https://fonts.gstatic.com'],
'font-src': ["'self'", 'data:', 'https://s3.amazonaws.com'],
'style-src': ["'self'", 'blob:', 'https://s3.amazonaws.com', "'unsafe-inline'"],
}),
new CopyWebpackPlugin([
Expand Down
12 changes: 2 additions & 10 deletions webpack/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,14 @@ export default {
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-woff',
},
loader: 'file-loader',
},
},
// WOFF2 Font
{
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-woff',
},
loader: 'file-loader',
},
},
// TTF Font
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8405,6 +8405,14 @@ file-entry-cache@^5.0.1:
dependencies:
flat-cache "^2.0.1"

file-loader@4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-4.2.0.tgz#5fb124d2369d7075d70a9a5abecd12e60a95215e"
integrity sha512-+xZnaK5R8kBJrHK0/6HRlrKNamvVS5rjyuju+rnyxRGuwUJwpAMsVzUl5dz6rK8brkzjV6JpcFNjp6NqV0g1OQ==
dependencies:
loader-utils "^1.2.3"
schema-utils "^2.0.0"

file-loader@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-3.0.1.tgz#f8e0ba0b599918b51adfe45d66d1e771ad560faa"
Expand Down

0 comments on commit 4fee821

Please sign in to comment.