diff --git a/_config.yml b/_config.yml index 7a9b11a..71617fb 100644 --- a/_config.yml +++ b/_config.yml @@ -212,8 +212,8 @@ exclude: - tools - README.md - LICENSE - - "*.config.js" - - package*.json + - "*.js" + - "package*.json" jekyll-archives: enabled: [categories, tags] diff --git a/_includes/head.html b/_includes/head.html index 011187c..4514666 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -99,9 +99,7 @@ - {% unless site.theme_mode %} - - {% endunless %} + {% include js-selector.html lang=lang %} diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index e62fd69..265b224 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -1,19 +1,21 @@ diff --git a/_includes/toc.html b/_includes/toc.html index 883bf13..0f87726 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -2,7 +2,7 @@ {% if enable_toc %}
-
+ diff --git a/_javascript/modules/components/toc/toc-desktop.js b/_javascript/modules/components/toc/toc-desktop.js index 5021a72..0aaba48 100644 --- a/_javascript/modules/components/toc/toc-desktop.js +++ b/_javascript/modules/components/toc/toc-desktop.js @@ -15,8 +15,11 @@ export class TocDesktop { } static init() { - if (document.getElementById('toc-wrapper')) { + const $tocWrapper = document.getElementById('toc-wrapper'); + + if ($tocWrapper) { tocbot.init(this.options); + $tocWrapper.classList.remove('invisible'); } } } diff --git a/_sass/pages/_post.scss b/_sass/pages/_post.scss index 19adf3f..9348c56 100644 --- a/_sass/pages/_post.scss +++ b/_sass/pages/_post.scss @@ -234,14 +234,11 @@ header { @keyframes fade-up { from { opacity: 0; - position: relative; - top: 2rem; + margin-top: 4rem; } to { opacity: 1; - position: relative; - top: 0; } } @@ -263,7 +260,7 @@ header { -webkit-animation: fade-up 0.8s; animation: fade-up 0.8s; overflow-y: auto; - max-height: calc(100vh - 2rem); + max-height: 100vh; scrollbar-width: none; margin-top: 2rem; @@ -336,7 +333,7 @@ header { position: fixed; bottom: 0; width: 15%; - height: 3.25rem; + height: 2.25rem; margin-left: -1px; background: linear-gradient(transparent, var(--main-bg) 70%); } diff --git a/rollup.config.js b/rollup.config.js index 3a1ae29..0e8a6c7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -11,11 +11,11 @@ const DIST = 'assets/js/dist'; const banner = `/*! * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} */`; - const frontmatter = `---\npermalink: /:basename\n---\n`; - const isProd = process.env.BUILD === 'production'; +let hasWatched = false; + function cleanup() { fs.rmSync(DIST, { recursive: true, force: true }); console.log(`> Directory "${DIST}" has been cleaned.`); @@ -39,6 +39,11 @@ function build( { src = SRC_DEFAULT, jekyll = false, outputName = null } = {} ) { const input = `${src}/${filename}.js`; + const shouldWatch = hasWatched ? false : true; + + if (!hasWatched) { + hasWatched = true; + } return { input, @@ -49,9 +54,7 @@ function build( banner, sourcemap: !isProd && !jekyll }, - watch: { - include: input - }, + ...(shouldWatch && { watch: { include: `${SRC_DEFAULT}/**/*.js` } }), plugins: [ babel({ babelHelpers: 'bundled',