diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39c428d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "Jekyll", + "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", + "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postCreateCommand": "bash .devcontainer/post-create.sh", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh" + }, + "extensions": [ + // Liquid tags auto-complete + "killalau.vscode-liquid-snippets", + // Liquid syntax highlighting and formatting + "Shopify.theme-check-vscode", + // Shell + "timonwong.shellcheck", + "mkhl.shfmt", + // Common formatter + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "stylelint.vscode-stylelint", + "yzhang.markdown-all-in-one", + // Git + "mhutchie.git-graph" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..a4bc282 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [ -f package.json ]; then + bash -i -c "nvm install --lts && nvm install-latest-npm" + npm i + npm run build +fi + +# Install dependencies for shfmt extension +curl -sS https://webi.sh/shfmt | sh &>/dev/null + +# Add OMZ plugins +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +sed -i -E "s/^(plugins=\()(git)(\))/\1\2 zsh-syntax-highlighting zsh-autosuggestions\3/" ~/.zshrc + +# Avoid git log use less +echo -e "\nunset LESS" >>~/.zshrc diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 393fa98..a51f37e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,11 +8,10 @@ updates: directory: "/" versioning-strategy: increase groups: - npm: - update-types: - - "major" - - "minor" - - "patch" + prod-deps: + dependency-type: production + dev-deps: + dependency-type: development schedule: interval: "weekly" - package-ecosystem: "github-actions" @@ -23,3 +22,7 @@ updates: - "major" schedule: interval: "weekly" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d0cc84a..4f2da0e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm install - run: npx semantic-release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa8d0c9..50a158b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,10 +36,10 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - name: Build Assets run: npm i && npm run build - name: Test Site - run: bash tools/test + run: bash tools/test.sh diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index a2cf4f6..f84f3bc 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -18,6 +18,6 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm i - run: npm test diff --git a/.gitignore b/.gitignore index d6bf509..0082d90 100644 --- a/.gitignore +++ b/.gitignore @@ -17,9 +17,10 @@ package-lock.json # IDE configurations .idea -.vscode +.vscode/* !.vscode/settings.json !.vscode/extensions.json +!.vscode/tasks.json # Misc _sass/dist diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100755 new mode 100644 index 7f23494..0a4b97d --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx --no -- commitlint --edit ${1} +npx --no -- commitlint --edit $1 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 52bd6fb..082bc94 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,13 +1,3 @@ { - "recommendations": [ - // Liquid tags auto-complete - "killalau.vscode-liquid-snippets", - // Liquid syntax highlighting and formatting - "Shopify.theme-check-vscode", - // Common formatter - "esbenp.prettier-vscode", - "foxundermoon.shell-format", - "stylelint.vscode-stylelint", - "yzhang.markdown-all-in-one" - ] + "recommendations": ["ms-vscode-remote.remote-containers"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index b0e2e09..5e8a04f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,6 @@ // Prettier "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, - "prettier.trailingComma": "none", // Shopify Liquid "files.associations": { "*.html": "liquid" @@ -15,13 +14,17 @@ "editor.defaultFormatter": "Shopify.theme-check-vscode" }, "[shellscript]": { - "editor.defaultFormatter": "foxundermoon.shell-format" + "editor.defaultFormatter": "mkhl.shfmt" }, // Disable vscode built-in stylelint "css.validate": false, "scss.validate": false, "less.validate": false, // Stylint extension settings - "stylelint.snippet": ["css", "less", "postcss", "scss"], - "stylelint.validate": ["css", "less", "postcss", "scss"] + "stylelint.snippet": ["css", "scss"], + "stylelint.validate": ["css", "scss"], + // Run tasks in macOS + "terminal.integrated.profiles.osx": { + "zsh": { "path": "/bin/zsh", "args": ["-l", "-i"] } + } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..99ed5c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,64 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Jekyll Server", + "type": "shell", + "command": "./tools/run.sh", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "detail": "Runs the Jekyll server with live reload." + }, + { + "label": "Build Jekyll Site", + "type": "shell", + "command": "./tools/test.sh", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build the Jekyll site for production." + }, + { + "label": "Build JS (watch)", + "type": "shell", + "command": "npm run watch:js", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS files in watch mode." + }, + { + "label": "Build CSS", + "type": "shell", + "command": "npm run build:css", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build CSS files." + }, + { + "label": "Build JS & CSS", + "type": "shell", + "command": "npm run build", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS & CSS for production." + }, + { + "label": "Run Jekyll Server + Build JS (watch)", + "dependsOn": ["Run Jekyll Server", "Build JS (watch)"], + "group": { + "kind": "build" + }, + "detail": "Runs both the Jekyll server with live reload and build JS files in watch mode." + } + ] +} diff --git a/Gemfile b/Gemfile index 672e9e4..66f9337 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,11 @@ source "https://rubygems.org" gemspec -group :test do - gem "html-proofer", "~> 5.0" +gem "html-proofer", "~> 5.0", group: :test + +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" end + +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] diff --git a/README.md b/README.md index 747b8bc..7e57b2a 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)][gem]  - [![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci]  - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  - [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license]  - [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy]  + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy?color=goldenrod)][license]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=orange)][gem]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=linuxcontainers)][open-container] [**Live Demo** →][demo] @@ -72,6 +72,7 @@ This project is published under [MIT License][license]. [ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster [codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade [license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE +[open-container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/cotes2020/jekyll-theme-chirpy [jekyllrb]: https://jekyllrb.com/ [clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ [demo]: https://cotes2020.github.io/chirpy-demo/ diff --git a/_config.yml b/_config.yml index 613b043..7a9b11a 100644 --- a/_config.yml +++ b/_config.yml @@ -16,20 +16,20 @@ timezone: Asia/Shanghai title: Chirpy # the main title -tagline: A text-focused Jekyll theme # it will display as the sub-title +tagline: A text-focused Jekyll theme # it will display as the subtitle description: >- # used by seo meta and the atom feed A minimal, responsive and feature-rich Jekyll theme for technical writing. # Fill in the protocol & hostname for your site. -# e.g. 'https://username.github.io', note that it does not end with a '/'. +# E.g. 'https://username.github.io', note that it does not end with a '/'. url: "" github: - username: github_username # change to your github username + username: github_username # change to your GitHub username twitter: - username: twitter_username # change to your twitter username + username: twitter_username # change to your Twitter username social: # Change to your full name. @@ -38,8 +38,8 @@ social: email: example@domain.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com/username # change to your Twitter homepage + - https://github.com/username # change to your GitHub homepage # Uncomment below to add more social links # - https://www.facebook.com/username # - https://www.linkedin.com/in/username @@ -70,8 +70,10 @@ analytics: domain: # fill in your Matomo domain cloudflare: id: # fill in your Cloudflare Web Analytics token + fathom: + id: # fill in your Fathom Site ID -# Pageviews settings +# Page views settings pageviews: provider: # now only supports 'goatcounter' @@ -83,8 +85,8 @@ pageviews: # # Available options: # -# light - Use the light color scheme -# dark - Use the dark color scheme +# light — Use the light color scheme +# dark — Use the dark color scheme # theme_mode: # [light | dark] @@ -106,7 +108,7 @@ social_preview_image: # string, local or CORS resources toc: true comments: - # Global switch for the post comment system. Keeping it empty means disabled. + # Global switch for the post-comment system. Keeping it empty means disabled. provider: # [disqus | utterances | giscus] # The provider options are as follows: disqus: @@ -136,9 +138,9 @@ assets: env: # [development | production] pwa: - enabled: true # the option for PWA feature (installable) + enabled: true # The option for PWA feature (installable) cache: - enabled: true # the option for PWA offline cache + enabled: true # The option for PWA offline cache # Paths defined here will be excluded from the PWA cache. # Usually its value is the `baseurl` of another website that # shares the same domain name as the current website. @@ -190,10 +192,6 @@ defaults: values: layout: page permalink: /:title/ - - scope: - path: assets/js/dist - values: - swcache: true sass: style: compressed diff --git a/_data/contact.yml b/_data/contact.yml index 1ed228a..ed40acb 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -26,3 +26,15 @@ # - type: stack-overflow # icon: 'fab fa-stack-overflow' # url: '' # Fill with your stackoverflow homepage +# +# - type: bluesky +# icon: 'fa-brands fa-bluesky' +# url: '' # Fill with your Bluesky profile link +# +# - type: reddit +# icon: 'fa-brands fa-reddit' +# url: '' # Fill with your Reddit profile link +# +# - type: threads +# icon: 'fa-brands fa-threads' +# url: '' # Fill with your Threads profile link diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml index c608298..a79e020 100644 --- a/_data/locales/ar.yml +++ b/_data/locales/ar.yml @@ -43,7 +43,7 @@ copyright: meta: باستخدام :PLATFORM السمة :THEME not_found: - statment: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. + statement: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. notification: update_found: يتوفر اصدار جديد للمحتوى. diff --git a/_data/locales/bg-BG.yml b/_data/locales/bg-BG.yml index 3e04993..3fb060f 100644 --- a/_data/locales/bg-BG.yml +++ b/_data/locales/bg-BG.yml @@ -43,7 +43,7 @@ copyright: meta: Създадено чрез :PLATFORM и :THEME тема not_found: - statment: Съжалявам, но на този URL адрес няма налично съдържание. + statement: Съжалявам, но на този URL адрес няма налично съдържание. notification: update_found: Налична е нова версия на съдържанието. diff --git a/_data/locales/cs-CZ.yml b/_data/locales/cs-CZ.yml index e515c08..cf93f61 100644 --- a/_data/locales/cs-CZ.yml +++ b/_data/locales/cs-CZ.yml @@ -43,7 +43,7 @@ copyright: meta: Použití :PLATFORM s motivem :THEME not_found: - statment: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. + statement: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. notification: update_found: Je k dispozici nová verze obsahu. diff --git a/_data/locales/de-DE.yml b/_data/locales/de-DE.yml index 6b187b4..6c9d91d 100644 --- a/_data/locales/de-DE.yml +++ b/_data/locales/de-DE.yml @@ -42,7 +42,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. + statement: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. notification: update_found: Eine neue Version ist verfügbar. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/el-GR.yml b/_data/locales/el-GR.yml index ab5fb0e..b6d2a86 100644 --- a/_data/locales/el-GR.yml +++ b/_data/locales/el-GR.yml @@ -43,7 +43,7 @@ copyright: meta: Αξιοποιώντας την :PLATFORM theme :THEME not_found: - statment: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. + statement: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. notification: update_found: Υπάρχει διαθέσιμη μια νέα έκδοση του περιεχομένου. diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 0dbe713..152d090 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -43,7 +43,7 @@ copyright: meta: Using the :THEME theme for :PLATFORM. not_found: - statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: A new version of content is available. diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml index 5529230..8f8d149 100644 --- a/_data/locales/es-ES.yml +++ b/_data/locales/es-ES.yml @@ -43,7 +43,7 @@ copyright: meta: Hecho con :PLATFORM usando el tema :THEME not_found: - statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. + statement: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. notification: update_found: Hay una nueva versión de contenido disponible. diff --git a/_data/locales/fi-FI.yml b/_data/locales/fi-FI.yml index c817d2b..60c9862 100644 --- a/_data/locales/fi-FI.yml +++ b/_data/locales/fi-FI.yml @@ -42,7 +42,7 @@ copyright: meta: Käytetään :PLATFORM iä Teema :THEME not_found: - statment: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. + statement: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. notification: update_found: Uusi versio sisällöstä on saatavilla. diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml index 72b034d..3f3c9a0 100644 --- a/_data/locales/fr-FR.yml +++ b/_data/locales/fr-FR.yml @@ -43,7 +43,7 @@ copyright: meta: Propulsé par :PLATFORM avec le thème :THEME not_found: - statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. + statement: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. notification: update_found: Une nouvelle version du contenu est disponible. diff --git a/_data/locales/hu-HU.yml b/_data/locales/hu-HU.yml index b09f2cd..53d88e9 100644 --- a/_data/locales/hu-HU.yml +++ b/_data/locales/hu-HU.yml @@ -45,7 +45,7 @@ copyright: meta: Készítve :PLATFORM motorral :THEME témával not_found: - statment: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. + statement: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. notification: update_found: Elérhető a tartalom új verziója. diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml index 29ad156..d772ec3 100644 --- a/_data/locales/id-ID.yml +++ b/_data/locales/id-ID.yml @@ -43,7 +43,7 @@ copyright: meta: Didukung oleh :PLATFORM dengan tema :THEME not_found: - statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. + statement: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. notification: update_found: Versi konten baru tersedia. diff --git a/_data/locales/it-IT.yml b/_data/locales/it-IT.yml index cf7b691..c8dfb44 100644 --- a/_data/locales/it-IT.yml +++ b/_data/locales/it-IT.yml @@ -42,7 +42,7 @@ copyright: meta: Servizio offerto da :PLATFORM con tema :THEME not_found: - statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. + statement: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. notification: update_found: Nuova versione del contenuto disponibile. diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml index 4dd221b..8297634 100644 --- a/_data/locales/ko-KR.yml +++ b/_data/locales/ko-KR.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: 해당 URL은 존재하지 않습니다. + statement: 해당 URL은 존재하지 않습니다. notification: update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml index 98848d5..d5bf728 100644 --- a/_data/locales/my-MM.yml +++ b/_data/locales/my-MM.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ + statement: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ notification: update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml index 4cef833..7ca60a7 100644 --- a/_data/locales/pt-BR.yml +++ b/_data/locales/pt-BR.yml @@ -43,7 +43,7 @@ copyright: meta: Feito com :PLATFORM usando o tema :THEME not_found: - statment: Desculpe, a página não foi encontrada. + statement: Desculpe, a página não foi encontrada. notification: update_found: Uma nova versão do conteúdo está disponível. diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml index 185407c..868ba95 100644 --- a/_data/locales/ru-RU.yml +++ b/_data/locales/ru-RU.yml @@ -42,7 +42,7 @@ copyright: meta: Использует тему :THEME для :PLATFORM not_found: - statment: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. + statement: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. notification: update_found: Доступна новая версия контента. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/sl-SI.yml b/_data/locales/sl-SI.yml index 7ab18b1..4d9434d 100644 --- a/_data/locales/sl-SI.yml +++ b/_data/locales/sl-SI.yml @@ -43,7 +43,7 @@ copyright: meta: Uporabljena :PLATFORM tema :THEME #Using the :PLATFORM theme :THEME not_found: - statment: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: Novejša različica vsebine je na voljo. #A new version of content is available. diff --git a/_data/locales/sv-SE.yml b/_data/locales/sv-SE.yml index 7ec2ee2..decb59c 100644 --- a/_data/locales/sv-SE.yml +++ b/_data/locales/sv-SE.yml @@ -43,7 +43,7 @@ copyright: meta: Byggd med :PLATFORM och temat :THEME not_found: - statment: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. + statement: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. notification: update_found: Det finns en ny version av innehållet. diff --git a/_data/locales/th.yml b/_data/locales/th.yml index 22cb00a..a3f41a0 100644 --- a/_data/locales/th.yml +++ b/_data/locales/th.yml @@ -43,7 +43,7 @@ copyright: meta: กำลังใช้ธีมของ :PLATFORM ชื่อ :THEME not_found: - statment: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ + statement: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ notification: update_found: มีเวอร์ชันใหม่ของเนื้อหา diff --git a/_data/locales/tr-TR.yml b/_data/locales/tr-TR.yml index 50d8110..768f57c 100644 --- a/_data/locales/tr-TR.yml +++ b/_data/locales/tr-TR.yml @@ -43,7 +43,7 @@ copyright: meta: :PLATFORM ve :THEME teması not_found: - statment: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. + statement: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. notification: update_found: İçeriğin yeni bir sürümü mevcut. diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml index b605073..8fef52e 100644 --- a/_data/locales/uk-UA.yml +++ b/_data/locales/uk-UA.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Вибачте, це посилання вказує на ресурс, що не існує. + statement: Вибачте, це посилання вказує на ресурс, що не існує. notification: update_found: Доступна нова версія вмісту. diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml index 617431a..6c2ceff 100644 --- a/_data/locales/vi-VN.yml +++ b/_data/locales/vi-VN.yml @@ -42,7 +42,7 @@ copyright: meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME not_found: - statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. + statement: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. notification: update_found: Đã có phiên bản mới của nội dung. diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml index f828134..5c13410 100644 --- a/_data/locales/zh-CN.yml +++ b/_data/locales/zh-CN.yml @@ -42,7 +42,7 @@ copyright: meta: 本站采用 :PLATFORM 主题 :THEME not_found: - statment: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 + statement: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 notification: update_found: 发现新版本的内容。 diff --git a/_data/locales/zh-TW.yml b/_data/locales/zh-TW.yml index 911253b..33a4330 100644 --- a/_data/locales/zh-TW.yml +++ b/_data/locales/zh-TW.yml @@ -42,7 +42,7 @@ copyright: meta: 本網站使用 :PLATFORM 產生,採用 :THEME 主題 not_found: - statment: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 + statement: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 notification: update_found: 發現新版本更新。 diff --git a/_data/origin/basic.yml b/_data/origin/basic.yml index 9027e6e..2d52982 100644 --- a/_data/origin/basic.yml +++ b/_data/origin/basic.yml @@ -20,9 +20,9 @@ mermaid: dayjs: js: common: /assets/lib/dayjs/dayjs.min.js - locale: /assets/lib/dayjs/locale/en.min.js - relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js - localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js + locale: /assets/lib/dayjs/locale/en.js + relativeTime: /assets/lib/dayjs/plugin/relativeTime.js + localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.js glightbox: css: /assets/lib/glightbox/glightbox.min.css diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index 1880666..afdb3d9 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,24 +20,24 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@11.0.2/dist/mermaid.min.js dayjs: js: - common: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js - locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/locale/:LOCALE.min.js - relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/relativeTime.min.js - localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/localizedFormat.min.js + common: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js + locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/locale/:LOCALE.js + relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/relativeTime.js + localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/localizedFormat.js glightbox: css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css diff --git a/_data/share.yml b/_data/share.yml index b1d077d..6f97568 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -36,3 +36,15 @@ platforms: # link: "https://fosstodon.org/" # - label: photog.social # link: "https://photog.social/" + # + # - type: Bluesky + # icon: "fa-brands fa-bluesky" + # link: "https://bsky.app/intent/compose?text=TITLE%20URL" + # + # - type: Reddit + # icon: "fa-brands fa-square-reddit" + # link: "https://www.reddit.com/submit?url=URL&title=TITLE" + # + # - type: Threads + # icon: "fa-brands fa-square-threads" + # link: "https://www.threads.net/intent/post?text=TITLE%20URL" diff --git a/_includes/analytics/fathom.html b/_includes/analytics/fathom.html new file mode 100644 index 0000000..4b603d3 --- /dev/null +++ b/_includes/analytics/fathom.html @@ -0,0 +1,7 @@ + + + diff --git a/_includes/comments/giscus.html b/_includes/comments/giscus.html index c8d48e6..f9becfe 100644 --- a/_includes/comments/giscus.html +++ b/_includes/comments/giscus.html @@ -17,6 +17,12 @@ initTheme = darkTheme; } + let lang = '{{ site.comments.giscus.lang | default: lang }}'; + {%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%} + if (lang.length > 2 && !lang.startsWith('zh')) { + lang = lang.slice(0, 2); + } + let giscusAttributes = { src: 'https://giscus.app/client.js', 'data-repo': '{{ site.comments.giscus.repo}}', @@ -29,7 +35,7 @@ 'data-emit-metadata': '0', 'data-theme': initTheme, 'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}', - 'data-lang': '{{ site.comments.giscus.lang | default: lang }}', + 'data-lang': lang, 'data-loading': 'lazy', crossorigin: 'anonymous', async: '' diff --git a/_includes/js-selector.html b/_includes/js-selector.html index b229b70..9965107 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -6,8 +6,6 @@ -{% assign js_dist = '/assets/js/dist/' %} - {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} {% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %} @@ -62,7 +60,8 @@ {% assign js = 'commons' %} {% endcase %} -{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %} +{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %} + {% if page.math %} @@ -93,7 +92,7 @@ {% if jekyll.environment == 'production' %} {% if site.pwa.enabled %} - + {% endif %} diff --git a/_javascript/_copyright b/_javascript/_copyright deleted file mode 100644 index 60a706b..0000000 --- a/_javascript/_copyright +++ /dev/null @@ -1 +0,0 @@ -Chirpy v<%= pkg.version %> | © 2019 <%= pkg.author %> | <%= pkg.license %> Licensed | <%= pkg.homepage %> diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index b5c7c6e..ac12043 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -4,12 +4,57 @@ * Dependencies: https://github.com/biati-digital/glightbox */ -const IMG_CLASS = 'popup'; +const html = document.documentElement; +const lightImages = '.popup:not(.dark)'; +const darkImages = '.popup:not(.light)'; +let selector = lightImages; + +function updateImages(current, reverse) { + if (selector === lightImages) { + selector = darkImages; + } else { + selector = lightImages; + } + + if (reverse === null) { + reverse = GLightbox({ selector: `${selector}` }); + } + + [current, reverse] = [reverse, current]; +} export function imgPopup() { - if (document.getElementsByClassName(IMG_CLASS).length === 0) { + if (document.querySelector('.popup') === null) { return; } - GLightbox({ selector: `.${IMG_CLASS}` }); + const hasDualImages = !( + document.querySelector('.popup.light') === null && + document.querySelector('.popup.dark') === null + ); + + if ( + (html.hasAttribute('data-mode') && + html.getAttribute('data-mode') === 'dark') || + (!html.hasAttribute('data-mode') && + window.matchMedia('(prefers-color-scheme: dark)').matches) + ) { + selector = darkImages; + } + + let current = GLightbox({ selector: `${selector}` }); + + if (hasDualImages && document.getElementById('mode-toggle')) { + let reverse = null; + + window.addEventListener('message', (event) => { + if ( + event.source === window && + event.data && + event.data.direction === ModeToggle.ID + ) { + updateImages(current, reverse); + } + }); + } } diff --git a/_javascript/modules/components/search-display.js b/_javascript/modules/components/search-display.js index 21d634e..40059ac 100644 --- a/_javascript/modules/components/search-display.js +++ b/_javascript/modules/components/search-display.js @@ -1,5 +1,5 @@ /** - * This script make #search-result-wrapper switch to unloaded or shown automatically. + * This script make #search-result-wrapper switch to unload or shown automatically. */ const btnSbTrigger = document.getElementById('sidebar-trigger'); diff --git a/_javascript/pwa/_frontmatter b/_javascript/pwa/_frontmatter deleted file mode 100644 index 97ecf0a..0000000 --- a/_javascript/pwa/_frontmatter +++ /dev/null @@ -1,3 +0,0 @@ ---- -permalink: /:basename ---- diff --git a/_javascript/pwa/sw.js b/_javascript/pwa/sw.js index bc67bd8..94b64bf 100644 --- a/_javascript/pwa/sw.js +++ b/_javascript/pwa/sw.js @@ -3,11 +3,23 @@ import { baseurl } from '../../_config.yml'; importScripts(`${baseurl}/assets/js/data/swconf.js`); const purge = swconf.purge; +const interceptor = swconf.interceptor; function verifyUrl(url) { - const requestPath = new URL(url).pathname; + const requestUrl = new URL(url); + const requestPath = requestUrl.pathname; - for (const path of swconf.denyPaths) { + if (!requestUrl.protocol.startsWith('http')) { + return false; + } + + for (const prefix of interceptor.urlPrefixes) { + if (requestUrl.href.startsWith(prefix)) { + return false; + } + } + + for (const path of interceptor.paths) { if (requestPath.startsWith(path)) { return false; } diff --git a/_posts/2019-08-08-text-and-typography.md b/_posts/2019-08-08-text-and-typography.md index 7064d5d..a8db26a 100644 --- a/_posts/2019-08-08-text-and-typography.md +++ b/_posts/2019-08-08-text-and-typography.md @@ -18,16 +18,16 @@ image: -# H1 - heading +# H1 — heading {: .mt-4 .mb-0 } -## H2 - heading +## H2 — heading {: data-toc-skip='' .mt-4 .mb-0 } -### H3 - heading +### H3 — heading {: data-toc-skip='' .mt-4 .mb-0 } -#### H4 - heading +#### H4 — heading {: data-toc-skip='' .mt-4 } diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index e6259ba..69eaf34 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -31,7 +31,7 @@ tags: [TAG] # TAG names should always be lowercase ### Timezone of Date -In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. +To accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. ### Categories and Tags @@ -147,7 +147,7 @@ _Image Caption_ #### Size -In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. +To prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. ```markdown ![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" } @@ -284,7 +284,7 @@ If you want to embed a video file directly, use the following syntax: {% include embed/video.html src='{URL}' %} ``` -Where `URL` is an URL to a video file e.g. `/path/to/sample/video.mp4`. +Where `URL` is a URL to a video file e.g. `/path/to/sample/video.mp4`. You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed. @@ -295,7 +295,7 @@ You can also specify additional attributes for the embedded video file. Here is - `muted=true` — audio will be initially silenced - `types` — specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -318,14 +318,14 @@ If you want to embed an audio file directly, use the following syntax: {% include embed/audio.html src='{URL}' %} ``` -Where `URL` is an URL to an audio file e.g. `/path/to/audio.mp3`. +Where `URL` is a URL to an audio file e.g. `/path/to/audio.mp3`. You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed. - `title='Text'` — title for an audio that appears below the audio and looks same as for images - `types` — specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -365,7 +365,7 @@ There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They ``` {: .nolineno } -### Filepath Hightlight +### Filepath Highlight ```md `/path/to/a/file.extend`{: .filepath} @@ -433,8 +433,6 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{% Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block. -``` - ## Mathematics We use [**MathJax**][mathjax] to generate mathematics. For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by: diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 1cea5be..3b41a3c 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -11,56 +11,74 @@ pin: true media_subpath: '/posts/20180809' --- -## Prerequisites +## Creating a Site Repository -Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. [Git](https://git-scm.com/) also needs to be installed. +When creating your site repository, you have two options depending on your needs: -## Installation +### Option 1. Using the Starter (Recommended) -### Creating a New Site +This approach simplifies upgrades, isolates unnecessary files, and is perfect for users who want to focus on writing with minimal configuration. -There are two ways to create a new repository for this theme: +1. Sign in to GitHub and navigate to the [**starter**][starter]. +2. Click the Use this template button and then select Create a new repository. +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) — Easy to upgrade, isolates irrelevant project files so you can focus on writing. -- [**GitHub Fork**](#option-2-github-fork) — Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended. +### Option 2. Forking the Theme -#### Option 1. Using the Chirpy Starter +This approach is convenient for modifying features or UI design, but presents challenges during upgrades. So don't try this unless you are familiar with Jekyll and plan to heavily modify this theme. -Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button Use this template > Create a new repository, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username. +1. Sign in to GitHub. +2. [Fork the theme repository](https://github.com/cotes2020/jekyll-theme-chirpy/fork). +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -#### Option 2. GitHub Fork +## Setting up the Environment -Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), and then rename it to `USERNAME.github.io` (`USERNAME` means your username). +Once your repository is created, it's time to set up your development environment. There are two primary methods: -Next, clone the repository to your local machine, make sure it has [Node.js][nodejs] installed, then go to the root directory of the repo and run the following command: +### Using Dev Containers (Recommended for Windows) -```console -$ bash tools/init -``` +Dev Containers offer an isolated environment using Docker, which prevents conflicts with your system and ensures all dependencies are managed within the container. -> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. -{: .prompt-info } +**Steps**: -The above command will: +1. Install Docker: + - On Windows/macOS, install [Docker Desktop][docker-desktop]. + - On Linux, install [Docker Engine][docker-engine]. +2. Install [VS Code][vscode] and the [Dev Containers extension][dev-containers]. +3. Clone your repository: + - For Docker Desktop: Start VS Code and [clone your repo in a container volume][dc-clone-in-vol]. + - For Docker Engine: Clone your repo locally, then [open it in a container][dc-open-in-container] via VS Code. +4. Wait for the Dev Containers setup to complete. -1. Check out the code to the [latest tag][latest-tag] (to ensure the stability of your site: as the code for the default branch is under development). -2. Remove non-essential sample files and take care of GitHub-related files. -3. Build CSS/JS assets files and then make them tracked by Git. -4. Automatically create a new commit to save the changes above. +### Setting up Natively (Recommended for Unix-like OS) -### Installing Dependencies +For Unix-like systems, you can set up the environment natively for optimal performance, though you can also use Dev Containers as an alternative. -Before running local server for the first time, go to the root directory of your site and run: +**Steps**: -```console -$ bundle -``` +1. Follow the [Jekyll installation guide](https://jekyllrb.com/docs/installation/) to install Jekyll and ensure [Git](https://git-scm.com/) is installed. +2. Clone your repository to your local machine. +3. If you forked the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory to initialize the repository. +4. Run command `bundle` in the root of your repository to install the dependencies. ## Usage +### Start the Jekyll Server + +To run the site locally, use the following command: + +```terminal +$ bundle exec jekyll s +``` + +> If you are using Dev Containers, you must run that command in the **VS Code** Terminal. +{: .prompt-info } + +After a few seconds, the local server will be available at . + ### Configuration -Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options: +Update the variables in `_config.yml`{: .filepath} as needed. Some typical options include: - `url` - `avatar` @@ -69,70 +87,65 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t ### Social Contact Options -Social contact options are displayed at the bottom of the sidebar. You can turn on/off the specified contacts in file `_data/contact.yml`{: .filepath }. +Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing Stylesheet +### Customizing the Stylesheet -If you need to customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of it. +To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. -Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main sass file `_sass/main.scss`{: .filepath} into the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign new value. +Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customing Static Assets +### Customizing Static Assets -Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/origin/cors.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published. +Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. -Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme). - -### Running Local Server - -You may want to preview the site contents before publishing, so just run it by: - -```console -$ bundle exec jekyll s -``` - -After a few seconds, the local service will be published at __. +If you prefer to self-host the static assets, refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme) repository. ## Deployment -Before the deployment begins, check out the file `_config.yml`{: .filepath} and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`. +Before deploying, check the `_config.yml`{: .filepath} file and ensure the `url` is configured correctly. If you prefer a [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or if you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to set the `baseurl` to your project name, starting with a slash, e.g., `/project-name`. Now you can choose _ONE_ of the following methods to deploy your Jekyll site. -### Deploy by Using GitHub Actions +### Deploy Using Github Actions -There are a few things to get ready for. +Prepare the following: - If you're on the GitHub Free plan, keep your site repository public. -- If you have committed `Gemfile.lock`{: .filepath} to the repository, and your local machine is not running Linux, go to the root of your site and update the platform list of the lock-file: +- If you have committed `Gemfile.lock`{: .filepath} to the repository, and your local machine is not running Linux, update the platform list of the lock file: ```console $ bundle lock --add-platform x86_64-linux ``` -Next, configure the _Pages_ service. +Next, configure the _Pages_ service: -1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu. -![Build source](pages-source-light.png){: .light .border .normal w='375' h='140' } -![Build source](pages-source-dark.png){: .dark .normal w='375' h='140' } +1. Go to your repository on GitHub. Select the _Settings_ tab, then click _Pages_ in the left navigation bar. In the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu. + ![Build source](pages-source-light.png){: .light .border .normal w='375' h='140' } + ![Build source](pages-source-dark.png){: .dark .normal w='375' h='140' } 2. Push any commits to GitHub to trigger the _Actions_ workflow. In the _Actions_ tab of your repository, you should see the workflow _Build and Deploy_ running. Once the build is complete and successful, the site will be deployed automatically. -At this point, you can go to the URL indicated by GitHub to access your site. +You can now visit the URL provided by GitHub to access your site. -### Manually Build and Deploy +### Manual Build and Deployment -On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server. +For self-hosted servers, you will need to build the site on your local machine and then upload the site files to the server. -Go to the root of the source project, and build your site as follows: +Navigate to the root of the source project, and build your site with the following command: ```console $ JEKYLL_ENV=production bundle exec jekyll b ``` -Unless you specified the output path, the generated site files will be placed in folder `_site`{: .filepath} of the project's root directory. Now you should upload those files to the target server. +Unless you specified the output path, the generated site files will be placed in the `_site`{: .filepath} folder of the project's root directory. Upload these files to your target server. [nodejs]: https://nodejs.org/ [starter]: https://github.com/cotes2020/chirpy-starter [pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow -[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags +[docker-desktop]: https://www.docker.com/products/docker-desktop/ +[docker-engine]: https://docs.docker.com/engine/install/ +[vscode]: https://code.visualstudio.com/ +[dev-containers]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers +[dc-clone-in-vol]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume +[dc-open-in-container]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index e6cf7c2..465cb08 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -1,6 +1,8 @@ /* The common styles */ html { + font-size: 16px; + @media (prefers-color-scheme: light) { &:not([data-mode]), &[data-mode='light'] { @@ -22,8 +24,6 @@ html { @include light-scheme; } } - - font-size: 16px; } body { @@ -42,20 +42,29 @@ body { @extend %heading; @if $i > 1 { - @extend %section; @extend %anchor; } @if $i < 5 { - $factor: 0.18rem; + $size-factor: 0.25rem; - @if $i == 1 { - $factor: 0.23rem; + @if $i > 1 { + $size-factor: 0.18rem; + + main & { + @if $i == 2 { + margin: 2.5rem 0 1.25rem; + } @else { + margin: 2rem 0 1rem; + } + } } - font-size: 1rem + (5 - $i) * $factor; + & { + font-size: 1rem + (5 - $i) * $size-factor; + } } @else { - font-size: 1rem; + font-size: 1.05rem; } } } @@ -80,9 +89,10 @@ img { } blockquote { - border-left: 5px solid var(--blockquote-border-color); + border-left: 0.125rem solid var(--blockquote-border-color); padding-left: 1rem; color: var(--blockquote-text-color); + margin-top: 0.5rem; > p:last-child { margin-bottom: 0; @@ -107,14 +117,14 @@ blockquote { } } - @include prompt('tip', '\f0eb', 'regular'); - @include prompt('info', '\f06a'); + @include prompt('tip', '\f0eb', $fa-style: 'regular'); + @include prompt('info', '\f06a', $rotate: 180); @include prompt('warning', '\f06a'); @include prompt('danger', '\f071'); } kbd { - font-family: inherit; + font-family: Lato, sans-serif; display: inline-block; vertical-align: middle; line-height: 1.3rem; @@ -124,7 +134,7 @@ kbd { padding-top: 0.1rem; color: var(--kbd-text-color); background-color: var(--kbd-bg-color); - border-radius: 0.25rem; + border-radius: $radius-sm; border: solid 1px var(--kbd-wrap-color); box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); } @@ -218,13 +228,13 @@ i { #access-lastmod { a { + color: inherit; + &:hover { @extend %link-hover; } @extend %no-bottom-border; - - color: inherit; } } @@ -682,15 +692,15 @@ $btn-mb: 0.5rem; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border-color); + /* Hide scrollbar for IE, Edge and Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + /* Hide scrollbar for Chrome, Safari and Opera */ &::-webkit-scrollbar { display: none; } - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - %sidebar-link-hover { &:hover { color: var(--sidebar-active-color); @@ -1036,6 +1046,9 @@ search { padding-bottom: 3rem; a { + font-size: 1.4rem; + line-height: 2.5rem; + &:hover { @extend %link-hover; } @@ -1043,9 +1056,6 @@ search { @extend %link-color; @extend %no-bottom-border; @extend %heading; - - font-size: 1.4rem; - line-height: 2.5rem; } > article { diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index d1b7103..42db4e2 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -10,17 +10,6 @@ font-family: $font-family-heading; } -%section { - main & { - margin-top: 2.5rem; - margin-bottom: 1.25rem; - - &:focus { - outline: none; /* avoid outline in Safari */ - } - } -} - %anchor { .anchor { font-size: 80%; @@ -92,7 +81,7 @@ } %rounded { - border-radius: $base-radius; + border-radius: $radius-lg; } %img-caption { @@ -123,7 +112,7 @@ } %text-highlight { - color: var(--text-muted-hightlight-color); + color: var(--text-muted-highlight-color); font-weight: 600; } @@ -187,7 +176,7 @@ transform: translateX(-50%); } -@mixin prompt($type, $fa-content, $fa-style: 'solid') { +@mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) { &.prompt-#{$type} { background-color: var(--prompt-#{$type}-bg); @@ -195,6 +184,10 @@ content: $fa-content; color: var(--prompt-#{$type}-icon-color); font: var(--fa-font-#{$fa-style}); + + @if $rotate != 0 { + transform: rotate(#{$rotate}deg); + } } } } diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index 68796f2..6bd7b40 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -50,13 +50,13 @@ html { @extend %rounded; @extend %code-snippet-bg; + overflow: auto; + padding-bottom: 0.75rem; + @at-root figure#{&} { @extend %code-snippet-bg; } - overflow: auto; - padding-bottom: 0.75rem; - pre { margin-bottom: 0; font-size: $code-font-size; @@ -104,7 +104,7 @@ code { font-size: $code-font-size; padding: 3px 5px; word-break: break-word; - border-radius: 4px; + border-radius: $radius-sm; background-color: var(--inline-code-bg); } @@ -261,7 +261,7 @@ div { .content > & { @include ml-mr(0); - border-radius: $base-radius; + border-radius: $radius-lg; } .code-header { diff --git a/_sass/addon/variables.scss b/_sass/addon/variables.scss index 8924a00..1d51cb1 100644 --- a/_sass/addon/variables.scss +++ b/_sass/addon/variables.scss @@ -16,7 +16,8 @@ $search-max-width: 200px !default; $footer-height: 5rem !default; $footer-height-large: 6rem !default; /* screen width: < 850px */ $main-content-max-width: 1250px !default; -$base-radius: 0.625rem !default; +$radius-sm: 6px !default; +$radius-lg: 10px !default; $back2top-size: 2.75rem !default; /* syntax highlight */ diff --git a/_sass/colors/syntax-dark.scss b/_sass/colors/syntax-dark.scss index d898c65..eb92204 100644 --- a/_sass/colors/syntax-dark.scss +++ b/_sass/colors/syntax-dark.scss @@ -7,7 +7,7 @@ --highlight-bg-color: #151515; --highlighter-rouge-color: #c9def1; --highlight-lineno-color: #808080; - --inline-code-bg: #323238; + --inline-code-bg: rgba(255, 255, 255, 0.05); --code-color: #b0b0b0; --code-header-text-color: #6a6a6a; --code-header-muted-color: #353535; diff --git a/_sass/colors/syntax-light.scss b/_sass/colors/syntax-light.scss index 6562c76..76aa669 100644 --- a/_sass/colors/syntax-light.scss +++ b/_sass/colors/syntax-light.scss @@ -8,17 +8,13 @@ --highlight-bg-color: #f6f8fa; --highlighter-rouge-color: #3f596f; --highlight-lineno-color: #9e9e9e; - --inline-code-bg: #f6f6f7; + --inline-code-bg: rgba(25, 25, 28, 0.05); --code-color: #3a3a3a; --code-header-text-color: #a3a3a3; --code-header-muted-color: #e5e5e5; --code-header-icon-color: #c9c8c8; --clipboard-checked-color: #43c743; - [class^='prompt-'] { - --inline-code-bg: #fbfafa; - } - /* --- Syntax highlight theme from `rougify style github` --- */ .highlight table td { diff --git a/_sass/colors/typography-dark.scss b/_sass/colors/typography-dark.scss index d9b1df6..12427ec 100644 --- a/_sass/colors/typography-dark.scss +++ b/_sass/colors/typography-dark.scss @@ -11,7 +11,7 @@ /* Common color */ --text-color: rgb(175, 176, 177); --text-muted-color: #868686; - --text-muted-hightlight-color: #aeaeae; + --text-muted-highlight-color: #aeaeae; --heading-color: #cccccc; --label-color: #a7a7a7; --blockquote-border-color: rgb(66, 66, 66); @@ -84,27 +84,29 @@ --prompt-danger-bg: rgb(86, 28, 8, 0.8); --prompt-danger-icon-color: #cd0202; - /* tags */ + /* Tags */ --tag-border: rgb(59, 79, 88); --tag-shadow: rgb(32, 33, 33); --dash-color: rgb(63, 65, 68); --search-tag-bg: #292828; - /* categories */ + /* Categories */ --categories-border: rgb(64, 66, 69, 0.5); --categories-hover-bg: rgb(73, 75, 76); --categories-icon-hover-color: white; - /* archives */ + /* Archive */ --timeline-node-bg: rgb(150, 152, 156); --timeline-color: rgb(63, 65, 68); --timeline-year-dot-color: var(--timeline-color); + color-scheme: dark; + .light { display: none; } - /* categories */ + /* Categories */ .categories.card, .list-group-item { background-color: var(--card-bg); @@ -138,8 +140,6 @@ ); } - color-scheme: dark; - /* stylelint-disable-next-line selector-id-pattern */ #disqus_thread { color-scheme: none; diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss index 11f052c..7800074 100644 --- a/_sass/colors/typography-light.scss +++ b/_sass/colors/typography-light.scss @@ -11,7 +11,7 @@ /* Common color */ --text-color: #34343c; --text-muted-color: #757575; - --text-muted-hightlight-color: inherit; + --text-muted-highlight-color: inherit; --heading-color: #2a2a2a; --label-color: #585858; --blockquote-border-color: #eeeeee; @@ -92,14 +92,6 @@ --tag-hover: rgb(222, 226, 230); --search-tag-bg: #f8f9fa; - [class^='prompt-'] { - --link-underline-color: rgb(219, 216, 216); - } - - .dark { - display: none; - } - /* Categories */ --categories-border: rgba(0, 0, 0, 0.125); --categories-hover-bg: var(--btn-border-color); @@ -109,4 +101,12 @@ --timeline-color: rgba(0, 0, 0, 0.075); --timeline-node-bg: #c2c6cc; --timeline-year-dot-color: #ffffff; + + [class^='prompt-'] { + --link-underline-color: rgb(219, 216, 216); + } + + .dark { + display: none; + } } /* light-scheme */ diff --git a/_sass/layout/categories.scss b/_sass/layout/categories.scss index 330d3d3..f12b963 100644 --- a/_sass/layout/categories.scss +++ b/_sass/layout/categories.scss @@ -16,7 +16,7 @@ } .card-header { - $radius: calc($base-radius - 1px); + $radius: calc($radius-lg - 1px); padding: 0.75rem; border-radius: $radius; diff --git a/_sass/layout/home.scss b/_sass/layout/home.scss index 7f9fd2e..0d95d7b 100644 --- a/_sass/layout/home.scss +++ b/_sass/layout/home.scss @@ -20,7 +20,7 @@ background: none; %img-radius { - border-radius: $base-radius $base-radius 0 0; + border-radius: $radius-lg $radius-lg 0 0; } .preview-img { @@ -131,7 +131,7 @@ /* Tablet */ @media all and (min-width: 768px) { %img-radius { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; } #post-list { diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 112541d..815db93 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -173,12 +173,12 @@ header { } &:first-child { - border-radius: $base-radius 0 0 $base-radius; + border-radius: $radius-lg 0 0 $radius-lg; left: 0.5px; } &:last-child { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; right: 0.5px; } } diff --git a/assets/404.html b/assets/404.html index 5b46cc8..af89d6d 100644 --- a/assets/404.html +++ b/assets/404.html @@ -11,4 +11,4 @@ redirect_from: {% include lang.html %} -

{{ site.data.locales[lang].not_found.statment }}

+

{{ site.data.locales[lang].not_found.statement }}

diff --git a/assets/js/data/swconf.js b/assets/js/data/swconf.js index 5c1ed29..798888a 100644 --- a/assets/js/data/swconf.js +++ b/assets/js/data/swconf.js @@ -22,14 +22,24 @@ const swconf = { {% endfor %} ], - {%- comment -%} The request url with below path will not be cached. {%- endcomment -%} - denyPaths: [ - {% for path in site.pwa.cache.deny_paths %} - {% unless path == empty %} - '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} - {% endunless %} - {% endfor %} - ], + interceptor: { + {%- comment -%} URLs containing the following paths will not be cached. {%- endcomment -%} + paths: [ + {% for path in site.pwa.cache.deny_paths %} + {% unless path == empty %} + '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} + {% endunless %} + {% endfor %} + ], + + {%- comment -%} URLs containing the following prefixes will not be cached. {%- endcomment -%} + urlPrefixes: [ + {% if site.analytics.goatcounter.id != nil and site.pageviews.provider == 'goatcounter' %} + 'https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/' + {% endif %} + ] + }, + purge: false {% else %} purge: true diff --git a/assets/lib b/assets/lib index b9c58cf..a231bc7 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit b9c58cf485a7dcbc833e698d67dd1850bdc93eb3 +Subproject commit a231bc7e2c67198e604950cb2be9147a0b2020c0 diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 91d618c..76ebe67 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| "plugin_type" => "theme" } - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = "~> 3.1" spec.add_runtime_dependency "jekyll", "~> 4.3" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" diff --git a/package.json b/package.json index 8600aa4..a73fee7 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "author": "Cotes Chung", "license": "MIT", + "since": 2019, "bugs": { "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" }, @@ -19,17 +20,18 @@ "watch:js": "rollup -c --bundleConfigAsCjs -w", "lint:scss": "stylelint _sass/**/*.scss", "lint:fix:scss": "npm run lint:scss -- --fix", - "test": "npm run lint:scss" + "test": "npm run lint:scss", + "prepare": "husky" }, "dependencies": { "@popperjs/core": "^2.11.8", "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.5", - "@babel/plugin-transform-class-properties": "^7.24.1", - "@babel/preset-env": "^7.24.5", - "@commitlint/cli": "^19.3.0", + "@babel/core": "^7.25.2", + "@babel/plugin-transform-class-properties": "^7.25.4", + "@babel/preset-env": "^7.25.4", + "@commitlint/cli": "^19.4.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", @@ -39,13 +41,12 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "concurrently": "^8.2.2", - "conventional-changelog-conventionalcommits": "^7.0.2", - "husky": "^9.0.11", + "conventional-changelog-conventionalcommits": "^8.0.0", + "husky": "^9.1.5", "purgecss": "^6.0.0", - "rollup": "^4.17.2", - "rollup-plugin-license": "^3.3.1", - "semantic-release": "^23.1.1", - "stylelint": "^16.5.0", + "rollup": "^4.21.0", + "semantic-release": "^24.1.0", + "stylelint": "^16.8.2", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { @@ -156,8 +157,8 @@ [ "@semantic-release/exec", { - "prepareCmd": "bash tools/release --prepare", - "publishCmd": "bash tools/release" + "prepareCmd": "bash tools/release.sh --prepare", + "publishCmd": "bash tools/release.sh" } ], [ diff --git a/rollup.config.js b/rollup.config.js index 823401e..22016b0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,38 +1,48 @@ import babel from '@rollup/plugin-babel'; import terser from '@rollup/plugin-terser'; -import license from 'rollup-plugin-license'; import { nodeResolve } from '@rollup/plugin-node-resolve'; -import fs from 'fs'; -import path from 'path'; import yaml from '@rollup/plugin-yaml'; +import fs from 'fs'; +import pkg from './package.json'; const SRC_DEFAULT = '_javascript'; -const DIST_DEFAULT = 'assets/js/dist'; const SRC_PWA = `${SRC_DEFAULT}/pwa`; +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'; -if (fs.existsSync(DIST_DEFAULT)) { - fs.rm(DIST_DEFAULT, { recursive: true, force: true }, (err) => { - if (err) { - throw err; - } - }); +function cleanup() { + fs.rmSync(DIST, { recursive: true, force: true }); + console.log(`> Directory "${DIST}" has been cleaned.`); } -function build(filename, opts = {}) { - const src = opts.src || SRC_DEFAULT; - const dist = opts.dist || DIST_DEFAULT; - const bannerUrl = - opts.bannerUrl || path.join(__dirname, SRC_DEFAULT, '_copyright'); - const commentStyle = opts.commentStyle || 'ignored'; - +function insertFrontmatter() { return { - input: [`${src}/${filename}.js`], + name: 'insert-frontmatter', + generateBundle(_, bundle) { + for (const chunkOrAsset of Object.values(bundle)) { + if (chunkOrAsset.type === 'chunk') { + chunkOrAsset.code = frontmatter + chunkOrAsset.code; + } + } + } + }; +} + +function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { + return { + input: `${src}/${filename}.js`, output: { - file: `${dist}/${filename}.min.js`, + file: `${DIST}/${filename}.min.js`, format: 'iife', name: 'Chirpy', + banner, sourcemap: !isProd }, watch: { @@ -46,18 +56,14 @@ function build(filename, opts = {}) { }), nodeResolve(), yaml(), - isProd && commentStyle === 'none' && terser(), - license({ - banner: { - commentStyle, - content: { file: bannerUrl } - } - }), - isProd && commentStyle !== 'none' && terser() + isProd && terser(), + jekyll && insertFrontmatter() ] }; } +cleanup(); + export default [ build('commons'), build('home'), @@ -65,10 +71,6 @@ export default [ build('page'), build('post'), build('misc'), - build('app', { src: SRC_PWA }), - build('sw', { - src: SRC_PWA, - bannerUrl: path.join(__dirname, SRC_PWA, '_frontmatter'), - commentStyle: 'none' - }) + build('app', { src: SRC_PWA, jekyll: true }), + build('sw', { src: SRC_PWA, jekyll: true }) ]; diff --git a/tools/init b/tools/init.sh similarity index 92% rename from tools/init rename to tools/init.sh index ed478d7..2ad72ab 100755 --- a/tools/init +++ b/tools/init.sh @@ -80,13 +80,13 @@ init_files() { rm -rf .github && mkdir -p .github/workflows mv "$temp/$ACTIONS_WORKFLOW" .github/workflows/"$ACTIONS_WORKFLOW" rm -rf "$temp" - - ## Cleanup image settings in site config - _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml fi + # Cleanup image settings in site config + _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml + # remove the other files - rm -rf _posts/* + rm -rf tools/init.sh tools/release.sh _posts/* # build assets npm i && npm run build diff --git a/tools/release b/tools/release.sh similarity index 88% rename from tools/release rename to tools/release.sh index c2ea59e..522c892 100755 --- a/tools/release +++ b/tools/release.sh @@ -37,7 +37,7 @@ help() { echo " 2. Merge the release branch into the default branch" echo echo "Usage:" - echo " bash ./tools/release [options]" + echo " bash $0 [options]" echo echo "Options:" echo " --prepare Preparation for release" @@ -111,13 +111,6 @@ prepare() { ## Build a Gem package build_gem() { - if $opt_pkg; then - BACKUP_PATH="$(mktemp -d)" - mkdir -p "$BACKUP_PATH"/css "$BACKUP_PATH"/js - [[ -d $CSS_DIST ]] && cp "$CSS_DIST"/* "$BACKUP_PATH"/css - [[ -d $JS_DIST ]] && cp "$JS_DIST"/* "$BACKUP_PATH"/js - fi - # Remove unnecessary theme settings sed -i -E "s/(^timezone:).*/\1/;s/(^cdn:).*/\1/;s/(^avatar:).*/\1/" $CONFIG rm -f ./*.gem @@ -132,14 +125,6 @@ build_gem() { echo -e "\n> Resume file changes ...\n" git reset git checkout . - - if $opt_pkg; then - # restore the dist files for future development - mkdir -p "$CSS_DIST" "$JS_DIST" - cp "$BACKUP_PATH"/css/* "$CSS_DIST" - cp "$BACKUP_PATH"/js/* "$JS_DIST" - rm -rf "$BACKUP_PATH" - fi } # Push the gem to RubyGems.org (using $GEM_HOST_API_KEY) diff --git a/tools/run b/tools/run.sh similarity index 88% rename from tools/run rename to tools/run.sh index 04f23f5..0efc452 100755 --- a/tools/run +++ b/tools/run.sh @@ -46,5 +46,9 @@ if $prod; then command="JEKYLL_ENV=production $command" fi +if [ -e /proc/1/cgroup ] && grep -q docker /proc/1/cgroup; then + command="$command --force_polling" +fi + echo -e "\n> $command\n" eval "$command" diff --git a/tools/test b/tools/test.sh similarity index 97% rename from tools/test rename to tools/test.sh index fe47d44..331de1c 100755 --- a/tools/test +++ b/tools/test.sh @@ -19,7 +19,7 @@ help() { echo echo "Usage:" echo - echo " bash ./tools/test [options]" + echo " bash $0 [options]" echo echo "Options:" echo ' -c, --config "" Specify config file(s)'