Skip to content

Commit 9e865e9

Browse files
committed
refined
1 parent e8800f4 commit 9e865e9

File tree

5 files changed

+144
-19
lines changed

5 files changed

+144
-19
lines changed

eleventy.config.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default function (eleventyConfig) {
1616
eleventyConfig.addPassthroughCopy({
1717
'src/assets': 'assets',
1818
'src/favicon.ico': '/favicon.ico',
19-
'robots.txt': '/robots.txt',
2019
'site.webmanifest': '/site.webmanifest',
2120
'sw.js': '/sw.js',
2221
})
@@ -32,7 +31,19 @@ export default function (eleventyConfig) {
3231

3332
// Ativar cache em produção
3433
if (process.env.ELEVENTY_ENV === 'production') {
34+
// Add cache control headers
3535
eleventyConfig.setBrowserSyncConfig({
36+
middleware: function(req, res, next) {
37+
// Cache static assets for 1 year
38+
if (req.url.match(/^\/(assets|styles|js)\/.*\.(jpg|jpeg|png|webp|avif|css|js)$/)) {
39+
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
40+
}
41+
// Cache HTML for 1 hour
42+
else if (req.url.match(/\.html$/) || req.url === '/') {
43+
res.setHeader('Cache-Control', 'public, max-age=3600');
44+
}
45+
next();
46+
},
3647
files: './dist/**/*',
3748
open: false,
3849
notify: false,
@@ -78,12 +89,18 @@ export default function (eleventyConfig) {
7889
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
7990
formats: ['avif', 'webp', 'auto'],
8091
failOnError: false,
81-
htmlOptions: {
82-
imgAttributes: {
83-
loading: 'lazy',
84-
decoding: 'async',
85-
},
92+
defaultAttributes: {
93+
loading: 'lazy',
94+
decoding: 'async',
95+
},
96+
filenameFormat: function(id, src, width, format) {
97+
const extension = format === 'jpeg' ? 'jpg' : format;
98+
return `${id}-${width}w.${extension}`;
8699
},
100+
urlPath: '/assets/images/',
101+
widths: [24, 48, 96, 128, 256, 384, 512, 768, 1024, null],
102+
minimumWidth: 24,
103+
maximumWidth: 1024,
87104
})
88105

89106
// Bundles for CSS and JS

src/_includes/critical.css

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/* Critical path CSS */
2+
:root {
3+
--primary-color: #ec4899;
4+
--primary-color-dark: #db2777;
5+
}
6+
7+
html {
8+
scroll-behavior: smooth;
9+
font-synthesis: none;
10+
}
11+
12+
body {
13+
margin: 0;
14+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
15+
line-height: 1.5;
16+
color: #1f2937;
17+
background-color: #fafafa;
18+
width: 100%;
19+
max-width: 100%;
20+
overflow-x: hidden;
21+
}
22+
23+
.header {
24+
background-color: #fff;
25+
backdrop-filter: blur(4px);
26+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
27+
position: fixed;
28+
top: 0;
29+
width: 100%;
30+
z-index: 50;
31+
}
32+
33+
.header__container {
34+
display: flex;
35+
flex-direction: column;
36+
justify-content: center;
37+
align-items: center;
38+
padding: 1rem 1.5rem;
39+
position: relative;
40+
}
41+
42+
@media (min-width: 768px) {
43+
.header__container {
44+
flex-direction: row;
45+
justify-content: space-between;
46+
}
47+
}
48+
49+
.logo {
50+
display: inline-flex;
51+
align-items: center;
52+
gap: 0.75rem;
53+
text-decoration: none;
54+
z-index: 50;
55+
flex-direction: column;
56+
}
57+
58+
@media (min-width: 768px) {
59+
.logo {
60+
flex-direction: row;
61+
}
62+
}
63+
64+
.logo__img {
65+
height: 4rem;
66+
width: auto;
67+
display: block;
68+
}
69+
70+
@media (min-width: 768px) {
71+
.logo__img {
72+
height: 3rem;
73+
}
74+
}
75+
76+
.logo__text {
77+
font-size: 1.25rem;
78+
font-weight: 600;
79+
color: var(--primary-color);
80+
text-align: center;
81+
}
82+
83+
@media (min-width: 768px) {
84+
.logo__text {
85+
font-size: 1.125rem;
86+
text-align: left;
87+
}
88+
}
89+
90+
.main {
91+
margin-top: 5rem;
92+
min-height: 100vh;
93+
display: flex;
94+
flex-direction: column;
95+
}

src/_includes/layout.liquid

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,20 @@
7777
href='https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'
7878
></noscript>
7979

80+
<!-- Critical CSS inline -->
81+
{% capture critical_css %}
82+
{% include 'critical.css' %}
83+
{% endcapture %}
84+
<style>
85+
{{ critical_css }}
86+
</style>
87+
8088
<!-- CSS principal carregado de forma não-bloqueante -->
8189
<link
8290
rel='preload'
8391
href='/styles/main.css'
8492
as='style'
85-
onload="this.onload=null;this.rel='stylesheet'"
93+
onload="this.onload=null;this.rel='stylesheet';window.performance.mark('css-loaded')"
8694
>
8795
<noscript><link rel='stylesheet' href='/styles/main.css'></noscript>
8896

@@ -129,7 +137,6 @@
129137
<header class='header'>
130138
<div class='header__container container'>
131139
<a href='/' class='logo'>
132-
<img src='/assets/logo.png' alt='{{ site.title }}' class='logo__img'>
133140
<span class='logo__text'>{{ site.title }}</span>
134141
</a>
135142
<button class='menu-toggle' id='menuToggle'>

src/assets/js/picomap.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,26 @@
3333
var a = l('button')
3434
return (
3535
(a.innerText = t),
36-
(a.style = `width: 20px; position: absolute; top: ${o}px; left: ${e}px`),
36+
(a.style = `width: 44px; height: 44px; position: absolute; top: ${o}px; left: ${e}px; cursor: pointer; display: flex; align-items: center; justify-content: center; background: white; border: 1px solid #ccc; border-radius: 4px;`),
3737
a.addEventListener('click', () => this.#o(i, h, s)),
3838
a
3939
)
4040
}
4141
#p() {
4242
var t = l('div')
4343
;((t.style = 'height: 100%; width: 100%; position: absolute; top: 0px; left: 0px'),
44+
// Up button
4445
t.append(this.#h('\u25b2', 0, 1, 0, 40, 20)),
45-
t.append(l('br')),
46-
t.append(this.#h('\u25c0', -1, 0, 0, 20, 40)),
47-
t.append(this.#h('\u25b6', 1, 0, 0, 60, 40)),
48-
t.append(l('br')),
49-
t.append(this.#h('\u25bc', 0, -1, 0, 40, 60)),
50-
t.append(l('br')),
51-
t.append(this.#h('+', 0, 0, 1, 40, 100)),
52-
t.append(l('br')),
53-
t.append(this.#h('-', 0, 0, -1, 40, 120)),
46+
// Left button
47+
t.append(this.#h('\u25c0', -1, 0, 0, 8, 72)),
48+
// Right button
49+
t.append(this.#h('\u25b6', 1, 0, 0, 72, 72)),
50+
// Down button
51+
t.append(this.#h('\u25bc', 0, -1, 0, 40, 124)),
52+
// Zoom in button
53+
t.append(this.#h('+', 0, 0, 1, 40, 176)),
54+
// Zoom out button
55+
t.append(this.#h('-', 0, 0, -1, 40, 228)),
5456
this.map.append(t))
5557
}
5658
#l(t, i, h, s, e) {

robots.txt renamed to src/robots.liquid

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
---
2+
layout: null
3+
permalink: /robots.txt
4+
---
15
# Configuração do arquivo robots.txt
26
User-agent: *
37
Allow: /
48

59
# Sitemap
6-
Sitemap: {{ site.baseUrl }}/sitemap.xml
10+
Sitemap: https://tialara.com.br/sitemap.xml
711

812
# Desativar rastreamento de arquivos de desenvolvimento
913
Disallow: /node_modules/

0 commit comments

Comments
 (0)