Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve lighthouse #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 1 addition & 120 deletions sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -608,126 +608,7 @@
}
}

/* homepage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

body.homepage {
#wrapper {
width: 100%;
min-height: 100vh;
min-height: 100dvh;
display: flex;
justify-content: center;
align-items: center;
font-size: var(--homepage-font-size);
}

main {
width: 100%;
max-width: var(--homepage-max-width);
min-height: 75vh;
min-height: 75dvh;
padding: 4em 0;
@media screen and (max-width: 425px) {
& {
padding: 2em 0;
}
}
}

#info {
padding: 0 15px;
display: flex;
gap: 1em;

img {
height: var(--avatar-size);
width: var(--avatar-size);
border-radius: 50%;
}

#text {
display: flex;
flex-direction: column;
justify-content: space-around;
line-height: 1.5;
gap: 0.5em;
}

#name, #id {
font-size: 1.1em;
}

#id {
margin-left: 0.5em;
color: var(--primary-color);
}

#bio {
color: var(--text-pale-color);
font-weight: 300;
}
}

#links {
padding: 0 15px;
margin: 1.75em 0 1.75em;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1em;
font-size: 1.1em;

a,
button {
text-decoration: none;
color: var(--text-color);

@media (hover: hover) {
&:hover {
color: var(--primary-color);
}
}
}

#left {
display: flex;
flex-wrap: wrap;
gap: 1em;

a {
border-bottom: 1.5px solid var(--primary-color);
line-height: 1.5;
}
}

#right {
display: flex;
gap: 0.5em;

button {
padding: 0;
border: none;
background-color: transparent;
cursor: pointer;
}
}

@media (max-width: 425px) {
#left {
gap: 0.75em;
}
}
}

#brief {
padding: 0 15px;
font-size: 1em;
line-height: var(--homepage-line-height);
}
}


/* header
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

Expand Down
125 changes: 125 additions & 0 deletions sass/preload-main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/**
* Prevent Layout Shifts
*/

/* homepage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

body.homepage {
#wrapper {
width: 100%;
min-height: 100vh;
min-height: 100dvh;
display: flex;
justify-content: center;
align-items: center;
font-size: var(--homepage-font-size);
}

main {
width: 100%;
max-width: var(--homepage-max-width);
min-height: 75vh;
min-height: 75dvh;
padding: 4em 0;

@media screen and (max-width: 425px) {
& {
padding: 2em 0;
}
}
}

#info {
padding: 0 15px;
display: flex;
gap: 1em;

img {
height: var(--avatar-size);
width: var(--avatar-size);
border-radius: 50%;
}

#text {
display: flex;
flex-direction: column;
justify-content: space-around;
line-height: 1.5;
gap: 0.5em;
}

#name,
#id {
font-size: 1.1em;
}

#id {
margin-left: 0.5em;
color: var(--primary-color);
}

#bio {
color: var(--text-pale-color);
font-weight: 300;
}
}

#links {
padding: 0 15px;
margin: 1.75em 0 1.75em;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1em;
font-size: 1.1em;

a,
button {
text-decoration: none;
color: var(--text-color);

@media (hover: hover) {
&:hover {
color: var(--primary-color);
}
}
}

#left {
display: flex;
flex-wrap: wrap;
gap: 1em;

a {
border-bottom: 1.5px solid var(--primary-color);
line-height: 1.5;
}
}

#right {
display: flex;
gap: 0.5em;

button {
padding: 0;
border: none;
background-color: transparent;
cursor: pointer;
}
}

@media (max-width: 425px) {
#left {
gap: 0.75em;
}
}
}

#brief {
padding: 0 15px;
font-size: 1em;
line-height: var(--homepage-line-height);
}
}
10 changes: 7 additions & 3 deletions templates/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
{% include "_custom_font.html" %}
{% include "_custom_css.html" %}
<link rel="stylesheet" href="/main.css">
<!-- Preload CSS for Prevent Layout Shifting -->
<link rel="preload" rel="stylesheet" href="/preload-main.css" />
<!-- Load CSS Asynchronously -->
<link rel="preload" rel="stylesheet" href="/main.css" media="print"
onload="this.onload=null;this.removeAttribute('media');" fetchpriority="high">
{% block head %}{% endblock head %}
{% include "_head_extend.html" %}
{%- block seo %}
{%- endblock seo %}
</head>

<body class="{% block page %}{% endblock page%}{% if config.extra.force_theme == "dark" %}dark{% endif %}">
<body class="{% block page %}{% endblock page%}{% if config.extra.force_theme == " dark" %}dark{% endif %}">
{% if not config.extra.force_theme %}
<script>
const theme = sessionStorage.getItem('theme');
Expand All @@ -42,4 +46,4 @@
<script src="/js/main.js"></script>
</body>

</html>
</html>
Loading
Loading