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 -->
|
<!-- Scripts -->
|
||||||
|
|
||||||
{% unless site.theme_mode %}
|
|
||||||
<script src="{{ '/assets/js/dist/theme.min.js' | relative_url }}"></script>
|
<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 -->
|
<!-- PWA -->
|
||||||
{% if site.pwa.enabled %}
|
{% if site.pwa.enabled %}
|
||||||
<script
|
<script
|
||||||
|
@ -145,6 +145,12 @@
|
||||||
></script>
|
></script>
|
||||||
{% endif %}
|
{% 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 -->
|
<!-- Web Analytics -->
|
||||||
{% for analytics in site.analytics %} {% capture str %}{{ analytics }}{%
|
{% for analytics in site.analytics %} {% capture str %}{{ analytics }}{%
|
||||||
endcapture %} {% assign platform = str | split: '{' | first %} {% if
|
endcapture %} {% assign platform = str | split: '{' | first %} {% if
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<!-- Display GoatCounter pageviews -->
|
<!-- Display GoatCounter pageviews -->
|
||||||
<script>
|
<script>
|
||||||
let pv = document.getElementById('pageviews');
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const pv = document.getElementById('pageviews');
|
||||||
|
|
||||||
if (pv !== null) {
|
if (pv !== null) {
|
||||||
const uri = location.pathname.replace(/\/$/, '');
|
const uri = location.pathname.replace(/\/$/, '');
|
||||||
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
||||||
|
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const count = data.count.replace(/\s/g, '');
|
const count = data.count.replace(/\s/g, '');
|
||||||
|
@ -15,5 +16,6 @@
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
pv.innerText = '1';
|
pv.innerText = '1';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
|
||||||
const banner = `/*!
|
const banner = `/*!
|
||||||
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
|
* ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage}
|
||||||
*/`;
|
*/`;
|
||||||
|
|
||||||
const frontmatter = `---\npermalink: /:basename\n---\n`;
|
const frontmatter = `---\npermalink: /:basename\n---\n`;
|
||||||
|
|
||||||
const isProd = process.env.BUILD === 'production';
|
const isProd = process.env.BUILD === 'production';
|
||||||
|
|
||||||
|
let hasWatched = false;
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
fs.rmSync(DIST, { recursive: true, force: true });
|
fs.rmSync(DIST, { recursive: true, force: true });
|
||||||
console.log(`> Directory "${DIST}" has been cleaned.`);
|
console.log(`> Directory "${DIST}" has been cleaned.`);
|
||||||
|
@ -39,6 +39,11 @@ function build(
|
||||||
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
|
{ src = SRC_DEFAULT, jekyll = false, outputName = null } = {}
|
||||||
) {
|
) {
|
||||||
const input = `${src}/${filename}.js`;
|
const input = `${src}/${filename}.js`;
|
||||||
|
const shouldWatch = hasWatched ? false : true;
|
||||||
|
|
||||||
|
if (!hasWatched) {
|
||||||
|
hasWatched = true;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
|
@ -49,9 +54,7 @@ function build(
|
||||||
banner,
|
banner,
|
||||||
sourcemap: !isProd && !jekyll
|
sourcemap: !isProd && !jekyll
|
||||||
},
|
},
|
||||||
watch: {
|
...(shouldWatch && { watch: { include: `${SRC_DEFAULT}/**/*.js` } }),
|
||||||
include: input
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
babel({
|
babel({
|
||||||
babelHelpers: 'bundled',
|
babelHelpers: 'bundled',
|
||||||
|
|
Loading…
Reference in a new issue