[TWIG] Replaced base.css @import with HTML link imports

According to 'High Performance Web Sites' (ISBN 10: 0596529309), @import has a negative impact on web page performance. Since all imports dependant on base.css will only start downloading after that one is fully gathered.
This commit is contained in:
Eliseu Amaro 2022-01-12 16:29:02 +00:00
parent 600a1511cb
commit c8daa82c1d
No known key found for this signature in database
GPG Key ID: 96DA09D4B97BC2D5
2 changed files with 55 additions and 29 deletions

View File

@ -1,8 +1,3 @@
@import url("../fonts/poppins/poppins.css");
@import url("../fonts/opensans/opensans.css");
@import url("reset.css");
@import url("widgets/buttons.css");
@import url("widgets/sections.css");
html { html {
scroll-margin-top: var(--xxl); scroll-margin-top: var(--xxl);
@ -12,16 +7,19 @@ html {
align-self: center; align-self: center;
fill: var(--foreground); fill: var(--foreground);
} }
.active { .active {
font-size: 1.1em; font-size: 1.1em;
font-family: 'Poppins', sans-serif; font-family: 'Poppins', sans-serif;
font-weight: 600; font-weight: 600;
} }
.anchor-hidden { .anchor-hidden {
width: 1px; width: 1px;
height: 1px; height: 1px;
overflow: hidden; overflow: hidden;
} }
.accessibility-menu { .accessibility-menu {
display: block; display: block;
position: absolute; position: absolute;
@ -35,17 +33,21 @@ html {
background-color: var(--background-hard) !important; background-color: var(--background-hard) !important;
border: 2px solid var(--border); border: 2px solid var(--border);
} }
.accessibility-menu ul { .accessibility-menu ul {
list-style-type: disc; list-style-type: disc;
margin-left: var(--m); margin-left: var(--m);
} }
.accessibility-menu:focus-within:not(:active) { .accessibility-menu:focus-within:not(:active) {
top: var(--s); top: var(--s);
left: var(--s); left: var(--s);
} }
.heading-no-margin { .heading-no-margin {
margin-bottom: initial; margin-bottom: initial;
} }
.page-header { .page-header {
z-index: 1; z-index: 1;
display: inline-flex; display: inline-flex;
@ -53,12 +55,13 @@ html {
position: fixed; position: fixed;
top: 0; top: 0;
align-items: baseline; align-items: baseline;
font-family: 'Poppins',sans-serif; font-family: 'Poppins', sans-serif;
height: var(--xxl); height: var(--xxl);
padding: var(--s); padding: var(--s);
background: var(--gradient) !important; background: var(--gradient) !important;
box-shadow: var(--shadow); box-shadow: var(--shadow);
} }
.header-instance { .header-instance {
display: flex; display: flex;
position: absolute; position: absolute;
@ -67,13 +70,16 @@ html {
align-self: center; align-self: center;
margin-left: auto; margin-left: auto;
} }
.header-instance > * { .header-instance > * {
margin: unset; margin: unset;
} }
.header-extra-actions { .header-extra-actions {
justify-self: flex-end; justify-self: flex-end;
margin-left: auto; margin-left: auto;
} }
.header-extra-actions[open] > *:not(summary) { .header-extra-actions[open] > *:not(summary) {
z-index: 2; z-index: 2;
position: absolute; position: absolute;
@ -85,10 +91,11 @@ html {
background: var(--background-hard); background: var(--background-hard);
box-shadow: var(--shadow); box-shadow: var(--shadow);
} }
.header-panel { .header-panel {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-family: 'Open Sans',sans-serif; font-family: 'Open Sans', sans-serif;
position: fixed; position: fixed;
top: 0; top: 0;
margin-top: var(--xxl); margin-top: var(--xxl);
@ -96,10 +103,12 @@ html {
padding: var(--s); padding: var(--s);
overflow-y: auto; overflow-y: auto;
} }
.panel-content { .panel-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.page-content-wrapper { .page-content-wrapper {
position: relative; position: relative;
top: var(--xxl); top: var(--xxl);
@ -108,54 +117,64 @@ html {
justify-content: center; justify-content: center;
padding: var(--s) var(--s) 0; padding: var(--s) var(--s) 0;
} }
.page-content { .page-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
} }
.markdown-blocks { .markdown-blocks {
border-radius: 0 0 var(--s) var(--s); border-radius: 0 0 var(--s) var(--s);
padding: var(--s); padding: var(--s);
background-color: var(--background-card) !important; background-color: var(--background-card) !important;
} }
.markdown-blocks ul { .markdown-blocks ul {
margin-left: 1em; margin-left: 1em;
list-style: disc; list-style: disc;
} }
.markdown-blocks ul li { .markdown-blocks ul li {
margin-bottom: 0.2em; margin-bottom: 0.2em;
} }
.doc-navigation { .doc-navigation {
border-radius: var(--s) var(--s) 0 0; border-radius: var(--s) var(--s) 0 0;
border-bottom: 0; border-bottom: 0;
padding: var(--s); padding: var(--s);
background-color: var(--background-card) !important; background-color: var(--background-card) !important;
} }
.doc-navigation ul { .doc-navigation ul {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
} }
/* < 720p */ @media only screen and (max-width: 1280px) {
@media only screen and (max-width:1280px) {
.page-header { .page-header {
width: 100%; width: 100%;
} }
.page-content-wrapper { .page-content-wrapper {
width: 100%; width: 100%;
} }
.page-content { .page-content {
max-width: 100%; max-width: 100%;
} }
.header-extra-actions[open] > *:not(summary) { .header-extra-actions[open] > *:not(summary) {
width: 100%; width: 100%;
} }
#panel-left-toggle:not(:checked)+.header-panel,
#panel-right-toggle:not(:checked)+.header-panel { #panel-left-toggle:not(:checked) + .header-panel,
#panel-right-toggle:not(:checked) + .header-panel {
display: none; display: none;
} }
#panel-left-toggle:checked+.header-panel,
#panel-right-toggle:checked+.header-panel, #panel-left-toggle:checked + .header-panel,
#panel-right-toggle:checked + .header-panel,
a[id|="anchor"]:target ~ .panel-content { a[id|="anchor"]:target ~ .panel-content {
display: flex; display: flex;
width: 100%; width: 100%;
@ -164,36 +183,28 @@ html {
background-color: var(--background-hard) !important; background-color: var(--background-hard) !important;
} }
} }
/* > 720p */
@media only screen and (min-width:1281px) { @media only screen and (min-width: 1281px) {
/*
* Using the Van de Graaf Canon and Tschicholds recommended 2:3 page-size ratio
* Except we use the whole page
*
* > .page-content-wrapper
* 100% * 2/3 = 66%
*
* > .header-panel
* 100 - 66% = 34%
* 34% / 2 = 17%
*/
.page-header { .page-header {
width: 100%; width: 100%;
} }
.header-panel { .header-panel {
width: 17vw; width: 17vw;
} }
.page-content-wrapper { .page-content-wrapper {
width: 66vw; width: 66vw;
} }
a[id|="anchor"]:target+.accessibility-target {
a[id|="anchor"]:target + .accessibility-target {
animation-name: highlight; animation-name: highlight;
animation-duration: 600ms; animation-duration: 600ms;
animation-timing-function: ease-in-out; animation-timing-function: ease-in-out;
} }
} }
/* > 1080p */
@media only screen and (min-width:1921px) { @media only screen and (min-width: 1921px) {
/* /*
* Using the Van de Graaf Canon and Tschicholds recommended 2:3 page-size ratio * Using the Van de Graaf Canon and Tschicholds recommended 2:3 page-size ratio
* *
@ -210,13 +221,16 @@ html {
width: 66vw; width: 66vw;
align-self: center; align-self: center;
} }
.header-panel { .header-panel {
width: 11vw; width: 11vw;
} }
.page-content-wrapper { .page-content-wrapper {
width: 44vw; width: 44vw;
} }
} }
@keyframes fadeIn { @keyframes fadeIn {
0% { 0% {
opacity: 0; opacity: 0;
@ -227,6 +241,7 @@ html {
transform: none; transform: none;
} }
} }
@keyframes fadeOut { @keyframes fadeOut {
100% { 100% {
opacity: 0; opacity: 0;
@ -237,6 +252,7 @@ html {
transform: none; transform: none;
} }
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@keyframes highlight { @keyframes highlight {
0% { 0% {
@ -255,6 +271,7 @@ html {
} }
} }
} }
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
@keyframes highlight { @keyframes highlight {
0% { 0% {

View File

@ -15,8 +15,17 @@
</title> </title>
{% block stylesheets %} {% block stylesheets %}
<link rel='preload' type='text/css' as='style' href="{{ asset('assets/default_theme/fonts/opensans/opensans.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/fonts/opensans/opensans.css') }}">
<link rel='preload' type='text/css' as='style' href="{{ asset('assets/default_theme/fonts/poppins/poppins.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/fonts/poppins/poppins.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/root.css') }}"> <link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/root.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/reset.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/base.css') }}"> <link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/base.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/widgets/buttons.css') }}">
<link rel='stylesheet' type='text/css' href="{{ asset('assets/default_theme/css/widgets/sections.css') }}">
{% for stylesheet in show_stylesheets(app.request.get('_route')) %} {% for stylesheet in show_stylesheets(app.request.get('_route')) %}
<link rel='preload' type='text/css' as='style' href="{{ preload(asset(stylesheet), { as: 'style' }) }}"> <link rel='preload' type='text/css' as='style' href="{{ preload(asset(stylesheet), { as: 'style' }) }}">