Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit a5e7d2a

Browse files
authored
Merge pull request #344 from openforge/load-perf
perf: add fallback to fonts, add preload to main js, remove double home
2 parents 2035fea + 04c0157 commit a5e7d2a

File tree

5 files changed

+116
-25
lines changed

5 files changed

+116
-25
lines changed

src/assets/fonts/Muli.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* vietnamese */
2+
@font-face {
3+
font-family: 'Muli';
4+
font-style: normal;
5+
font-weight: 400;
6+
src: local('Muli Regular'), local('Muli-Regular'), url(https://fonts.gstatic.com/s/muli/v12/7Auwp_0qiz-afT3GLQjUwkQ1OQ.woff2) format('woff2');
7+
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
8+
font-display: fallback;
9+
}
10+
/* latin-ext */
11+
@font-face {
12+
font-family: 'Muli';
13+
font-style: normal;
14+
font-weight: 400;
15+
src: local('Muli Regular'), local('Muli-Regular'), url(https://fonts.gstatic.com/s/muli/v12/7Auwp_0qiz-afTzGLQjUwkQ1OQ.woff2) format('woff2');
16+
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
17+
font-display: fallback;
18+
}
19+
/* latin */
20+
@font-face {
21+
font-family: 'Muli';
22+
font-style: normal;
23+
font-weight: 400;
24+
src: local('Muli Regular'), local('Muli-Regular'), url(https://fonts.gstatic.com/s/muli/v12/7Auwp_0qiz-afTLGLQjUwkQ.woff2) format('woff2');
25+
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;
26+
font-display: fallback;
27+
}

src/assets/fonts/Roboto.css

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* cyrillic-ext */
2+
@font-face {
3+
font-family: 'Roboto';
4+
font-style: normal;
5+
font-weight: 700;
6+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCRc4AMP6lbBP.woff2) format('woff2');
7+
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
8+
font-display: fallback;
9+
}
10+
/* cyrillic */
11+
@font-face {
12+
font-family: 'Roboto';
13+
font-style: normal;
14+
font-weight: 700;
15+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfABc4AMP6lbBP.woff2) format('woff2');
16+
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
17+
font-display: fallback;
18+
}
19+
/* greek-ext */
20+
@font-face {
21+
font-family: 'Roboto';
22+
font-style: normal;
23+
font-weight: 700;
24+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCBc4AMP6lbBP.woff2) format('woff2');
25+
unicode-range: U+1F00-1FFF;
26+
font-display: fallback;
27+
}
28+
/* greek */
29+
@font-face {
30+
font-family: 'Roboto';
31+
font-style: normal;
32+
font-weight: 700;
33+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBxc4AMP6lbBP.woff2) format('woff2');
34+
unicode-range: U+0370-03FF;
35+
font-display: fallback;
36+
}
37+
/* vietnamese */
38+
@font-face {
39+
font-family: 'Roboto';
40+
font-style: normal;
41+
font-weight: 700;
42+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfCxc4AMP6lbBP.woff2) format('woff2');
43+
unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
44+
font-display: fallback;
45+
}
46+
/* latin-ext */
47+
@font-face {
48+
font-family: 'Roboto';
49+
font-style: normal;
50+
font-weight: 700;
51+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfChc4AMP6lbBP.woff2) format('woff2');
52+
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
53+
font-display: fallback;
54+
}
55+
/* latin */
56+
@font-face {
57+
font-family: 'Roboto';
58+
font-style: normal;
59+
font-weight: 700;
60+
src: local('Roboto Bold'), local('Roboto-Bold'), url(https://fonts.gstatic.com/s/roboto/v18/KFOlCnqEu92Fr1MmWUlfBBc4AMP6lQ.woff2) format('woff2');
61+
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;
62+
font-display: fallback;
63+
}

src/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
<link rel="icon" type="image/x-icon" href="/assets/icon/favicon.ico">
2828
<link rel="manifest" href="/manifest.json">
2929

30-
<script src="/build/app.js"></script>
31-
<link href='https://fonts.googleapis.com/css?family=Roboto:700' as='stylesheet'>
32-
<link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
30+
<script rel="preload" src="/build/app.js" as="script"></script>
31+
<link href='/assets/fonts/Roboto.css' rel='stylesheet'>
32+
<link href="/assets/fonts/Muli.css" rel="stylesheet">
3333
<!-- <link rel='stylesheet' href="/build/app.css"> Should have this; but it breaks smooth scroll -->
3434

3535
<!-- In case JavaScript is not available -->

src/pages/app-home/app-home.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,33 @@ export class AppHome {
2929

3030
/* tslint:disable-next-line */
3131
$(window).on('scroll resize', function() {
32-
const pos = $('#content-panel-inner').offset().top + $('#content-panel-inner').height() / 2;
33-
let done = false;
34-
$('.content-panel').each(function() {
35-
if (!done && pos <= Math.floor($(this).offset().top + $(this).height())) {
36-
const newDescr = $(this)
32+
if ($('#content-panel-inner') && $('#content-panel-inner').offset()) {
33+
const pos = $('#content-panel-inner').offset().top + $('#content-panel-inner').height() / 2;
34+
let done = false;
35+
$('.content-panel').each(function() {
36+
if (!done && pos <= Math.floor($(this).offset().top + $(this).height())) {
37+
const newDescr = $(this)
38+
.find('.description')
39+
.html();
40+
$('#content-panel-inner').html(newDescr);
41+
42+
done = true;
43+
}
44+
});
45+
46+
if (
47+
$('#content-panel-inner').offset().top ===
48+
$('.content-panel')
49+
.first()
50+
.offset().top
51+
) {
52+
const newDescr = $('.content-panel')
53+
.first()
3754
.find('.description')
3855
.html();
39-
$('#content-panel-inner').html(newDescr);
4056

41-
done = true;
57+
$('#content-panel-inner').html(newDescr);
4258
}
43-
});
44-
45-
if (
46-
$('#content-panel-inner').offset().top ===
47-
$('.content-panel')
48-
.first()
49-
.offset().top
50-
) {
51-
const newDescr = $('.content-panel')
52-
.first()
53-
.find('.description')
54-
.html();
55-
56-
$('#content-panel-inner').html(newDescr);
5759
}
5860
});
5961

src/pages/open-forge-app/open-forge-app.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export class OpenForgeApp {
107107
<stencil-route url="/juntoscope" component="app-case-study" />
108108
<stencil-route url="/terms-of-service" component="app-tos" />
109109
<stencil-route url="/service-level-agreement" component="app-service-level-agreement" />
110-
<stencil-route component="app-home" />
111110
</stencil-route-switch>
112111
</stencil-router>
113112
);

0 commit comments

Comments
 (0)