Skip to content

Commit bb58aed

Browse files
committed
Merge branch 'master' into production
2 parents 44397d0 + dfdbc79 commit bb58aed

File tree

7 files changed

+35
-32
lines changed

7 files changed

+35
-32
lines changed

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ exclude:
212212
- tools
213213
- README.md
214214
- LICENSE
215-
- "*.config.js"
216-
- package*.json
215+
- "*.js"
216+
- "package*.json"
217217

218218
jekyll-archives:
219219
enabled: [categories, tags]

_includes/head.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@
9999

100100
<!-- Scripts -->
101101

102-
{% unless site.theme_mode %}
103-
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
104-
{% endunless %}
102+
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
105103

106104
{% include js-selector.html lang=lang %}
107105

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<!-- Display GoatCounter pageviews -->
22
<script>
3-
let pv = document.getElementById('pageviews');
3+
document.addEventListener('DOMContentLoaded', () => {
4+
const pv = document.getElementById('pageviews');
45

5-
if (pv !== null) {
6-
const uri = location.pathname.replace(/\/$/, '');
7-
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
6+
if (pv !== null) {
7+
const uri = location.pathname.replace(/\/$/, '');
8+
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
89

9-
fetch(url)
10-
.then((response) => response.json())
11-
.then((data) => {
12-
const count = data.count.replace(/\s/g, '');
13-
pv.innerText = new Intl.NumberFormat().format(count);
14-
})
15-
.catch((error) => {
16-
pv.innerText = '1';
17-
});
18-
}
10+
fetch(url)
11+
.then((response) => response.json())
12+
.then((data) => {
13+
const count = data.count.replace(/\s/g, '');
14+
pv.innerText = new Intl.NumberFormat().format(count);
15+
})
16+
.catch((error) => {
17+
pv.innerText = '1';
18+
});
19+
}
20+
});
1921
</script>

_includes/toc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% if enable_toc %}
44
<div class="toc-border-cover z-3"></div>
5-
<section id="toc-wrapper" class="position-sticky ps-0 pe-4">
5+
<section id="toc-wrapper" class="invisible position-sticky ps-0 pe-4 pb-4">
66
<h2 class="panel-heading ps-3 pb-2 mb-0">{{- site.data.locales[include.lang].panel.toc -}}</h2>
77
<nav id="toc"></nav>
88
</section>

_javascript/modules/components/toc/toc-desktop.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ export class TocDesktop {
1515
}
1616

1717
static init() {
18-
if (document.getElementById('toc-wrapper')) {
18+
const $tocWrapper = document.getElementById('toc-wrapper');
19+
20+
if ($tocWrapper) {
1921
tocbot.init(this.options);
22+
$tocWrapper.classList.remove('invisible');
2023
}
2124
}
2225
}

_sass/pages/_post.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,11 @@ header {
234234
@keyframes fade-up {
235235
from {
236236
opacity: 0;
237-
position: relative;
238-
top: 2rem;
237+
margin-top: 4rem;
239238
}
240239

241240
to {
242241
opacity: 1;
243-
position: relative;
244-
top: 0;
245242
}
246243
}
247244

@@ -263,7 +260,7 @@ header {
263260
-webkit-animation: fade-up 0.8s;
264261
animation: fade-up 0.8s;
265262
overflow-y: auto;
266-
max-height: calc(100vh - 2rem);
263+
max-height: 100vh;
267264
scrollbar-width: none;
268265
margin-top: 2rem;
269266

@@ -336,7 +333,7 @@ header {
336333
position: fixed;
337334
bottom: 0;
338335
width: 15%;
339-
height: 3.25rem;
336+
height: 2.25rem;
340337
margin-left: -1px;
341338
background: linear-gradient(transparent, var(--main-bg) 70%);
342339
}

rollup.config.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
1111
const banner = `/*!
1212
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
1313
*/`;
14-
1514
const frontmatter = `---\npermalink: /:basename\n---\n`;
16-
1715
const isProd = process.env.BUILD === 'production';
1816

17+
let hasWatched = false;
18+
1919
function cleanup() {
2020
fs.rmSync(DIST, { recursive: true, force: true });
2121
console.log(`> Directory "${DIST}" has been cleaned.`);
@@ -39,6 +39,11 @@ function build(
3939
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
4040
) {
4141
const input = `${src}/${filename}.js`;
42+
const shouldWatch = hasWatched ? false : true;
43+
44+
if (!hasWatched) {
45+
hasWatched = true;
46+
}
4247

4348
return {
4449
input,
@@ -49,9 +54,7 @@ function build(
4954
banner,
5055
sourcemap: !isProd && !jekyll
5156
},
52-
watch: {
53-
include: input
54-
},
57+
...(shouldWatch && { watch: { include: `${SRC_DEFAULT}/**/*.js` } }),
5558
plugins: [
5659
babel({
5760
babelHelpers: 'bundled',

0 commit comments

Comments
 (0)