diff --git a/_includes/head.html b/_includes/head.html index 4d756c3..9c75aec 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -133,10 +133,10 @@ - {% unless site.theme_mode %} - {% endunless %} {% include js-selector.html lang=lang %} {% if - jekyll.environment == 'production' %} + + {% include js-selector.html lang=lang %} {% if jekyll.environment == + 'production' %} {% if site.pwa.enabled %} {% endif %} + + {% for analytics in site.analytics %} {% capture str %}{{ analytics }}{% + endcapture %} {% assign platform = str | split: '{' | first %} {% if + site.analytics[platform].id and site.analytics[platform].id != empty %} {% + include analytics/{{ platform }}.html %} {% endif %} {% endfor %} {% endif %} + {% for analytics in site.analytics %} {% capture str %}{{ analytics }}{% endcapture %} {% assign platform = str | split: '{' | first %} {% if diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index e62fd69..20719b4 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -1,12 +1,13 @@ 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',