Merge upstream changes
Some checks failed
Build and Deploy Test Version (with Drafts) - next.asandikci.com / build-drafts-and-deploy (push) Failing after 1m57s
Some checks failed
Build and Deploy Test Version (with Drafts) - next.asandikci.com / build-drafts-and-deploy (push) Failing after 1m57s
This commit is contained in:
commit
b0bfb363ae
3 changed files with 25 additions and 14 deletions
|
@ -133,10 +133,10 @@
|
|||
|
||||
<!-- Scripts -->
|
||||
|
||||
{% unless site.theme_mode %}
|
||||
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
|
||||
{% endunless %} {% include js-selector.html lang=lang %} {% if
|
||||
jekyll.environment == 'production' %}
|
||||
|
||||
{% include js-selector.html lang=lang %} {% if jekyll.environment ==
|
||||
'production' %}
|
||||
<!-- PWA -->
|
||||
{% if site.pwa.enabled %}
|
||||
<script
|
||||
|
@ -145,6 +145,12 @@
|
|||
></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Web Analytics -->
|
||||
{% 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 %}
|
||||
|
||||
<!-- Web Analytics -->
|
||||
{% for analytics in site.analytics %} {% capture str %}{{ analytics }}{%
|
||||
endcapture %} {% assign platform = str | split: '{' | first %} {% if
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<!-- Display GoatCounter pageviews -->
|
||||
<script>
|
||||
let pv = document.getElementById('pageviews');
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const pv = document.getElementById('pageviews');
|
||||
|
||||
if (pv !== null) {
|
||||
const uri = location.pathname.replace(/\/$/, '');
|
||||
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
||||
if (pv !== null) {
|
||||
const uri = location.pathname.replace(/\/$/, '');
|
||||
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
||||
|
||||
fetch(url)
|
||||
fetch(url)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
const count = data.count.replace(/\s/g, '');
|
||||
|
@ -15,5 +16,6 @@
|
|||
.catch((error) => {
|
||||
pv.innerText = '1';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue