Merge branch 'master' into production

This commit is contained in:
Cotes Chung 2024-08-27 15:22:53 +08:00
commit a2bf5dc58e
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
74 changed files with 534 additions and 323 deletions

View file

@ -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"
]
}
}
}

View file

@ -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

View file

@ -8,11 +8,10 @@ updates:
directory: "/" directory: "/"
versioning-strategy: increase versioning-strategy: increase
groups: groups:
npm: prod-deps:
update-types: dependency-type: production
- "major" dev-deps:
- "minor" dependency-type: development
- "patch"
schedule: schedule:
interval: "weekly" interval: "weekly"
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
@ -23,3 +22,7 @@ updates:
- "major" - "major"
schedule: schedule:
interval: "weekly" interval: "weekly"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly

View file

@ -24,7 +24,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: latest node-version: lts/*
- run: npm install - run: npm install
- run: npx semantic-release - run: npx semantic-release

View file

@ -36,10 +36,10 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: latest node-version: lts/*
- name: Build Assets - name: Build Assets
run: npm i && npm run build run: npm i && npm run build
- name: Test Site - name: Test Site
run: bash tools/test run: bash tools/test.sh

View file

@ -18,6 +18,6 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: latest node-version: lts/*
- run: npm i - run: npm i
- run: npm test - run: npm test

3
.gitignore vendored
View file

@ -17,9 +17,10 @@ package-lock.json
# IDE configurations # IDE configurations
.idea .idea
.vscode .vscode/*
!.vscode/settings.json !.vscode/settings.json
!.vscode/extensions.json !.vscode/extensions.json
!.vscode/tasks.json
# Misc # Misc
_sass/dist _sass/dist

5
.husky/commit-msg Executable file → Normal file
View file

@ -1,4 +1 @@
#!/bin/sh npx --no -- commitlint --edit $1
. "$(dirname "$0")/_/husky.sh"
npx --no -- commitlint --edit ${1}

View file

@ -1,13 +1,3 @@
{ {
"recommendations": [ "recommendations": ["ms-vscode-remote.remote-containers"]
// 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"
]
} }

11
.vscode/settings.json vendored
View file

@ -2,7 +2,6 @@
// Prettier // Prettier
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"prettier.trailingComma": "none",
// Shopify Liquid // Shopify Liquid
"files.associations": { "files.associations": {
"*.html": "liquid" "*.html": "liquid"
@ -15,13 +14,17 @@
"editor.defaultFormatter": "Shopify.theme-check-vscode" "editor.defaultFormatter": "Shopify.theme-check-vscode"
}, },
"[shellscript]": { "[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format" "editor.defaultFormatter": "mkhl.shfmt"
}, },
// Disable vscode built-in stylelint // Disable vscode built-in stylelint
"css.validate": false, "css.validate": false,
"scss.validate": false, "scss.validate": false,
"less.validate": false, "less.validate": false,
// Stylint extension settings // Stylint extension settings
"stylelint.snippet": ["css", "less", "postcss", "scss"], "stylelint.snippet": ["css", "scss"],
"stylelint.validate": ["css", "less", "postcss", "scss"] "stylelint.validate": ["css", "scss"],
// Run tasks in macOS
"terminal.integrated.profiles.osx": {
"zsh": { "path": "/bin/zsh", "args": ["-l", "-i"] }
}
} }

64
.vscode/tasks.json vendored Normal file
View file

@ -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."
}
]
}

View file

@ -4,6 +4,11 @@ source "https://rubygems.org"
gemspec gemspec
group :test do gem "html-proofer", "~> 5.0", group: :test
gem "html-proofer", "~> 5.0"
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end end
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

View file

@ -6,11 +6,11 @@
A minimal, responsive, and feature-rich Jekyll theme for technical writing. 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]&nbsp; [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]&nbsp;
[![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci]&nbsp; [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy]&nbsp;
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]&nbsp; [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy?color=goldenrod)][license]&nbsp;
[![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license]&nbsp; [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=orange)][gem]&nbsp;
[![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=linuxcontainers)][open-container]
[**Live Demo** →][demo] [**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 [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 [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 [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/ [jekyllrb]: https://jekyllrb.com/
[clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ [clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
[demo]: https://cotes2020.github.io/chirpy-demo/ [demo]: https://cotes2020.github.io/chirpy-demo/

View file

@ -16,20 +16,20 @@ timezone: Asia/Shanghai
title: Chirpy # the main title 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 description: >- # used by seo meta and the atom feed
A minimal, responsive and feature-rich Jekyll theme for technical writing. A minimal, responsive and feature-rich Jekyll theme for technical writing.
# Fill in the protocol & hostname for your site. # 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: "" url: ""
github: github:
username: github_username # change to your github username username: github_username # change to your GitHub username
twitter: twitter:
username: twitter_username # change to your twitter username username: twitter_username # change to your Twitter username
social: social:
# Change to your full name. # Change to your full name.
@ -38,8 +38,8 @@ social:
email: example@domain.com # change to your email address email: example@domain.com # change to your email address
links: links:
# The first element serves as the copyright owner's link # The first element serves as the copyright owner's link
- https://twitter.com/username # change to your twitter homepage - https://twitter.com/username # change to your Twitter homepage
- https://github.com/username # change to your github homepage - https://github.com/username # change to your GitHub homepage
# Uncomment below to add more social links # Uncomment below to add more social links
# - https://www.facebook.com/username # - https://www.facebook.com/username
# - https://www.linkedin.com/in/username # - https://www.linkedin.com/in/username
@ -70,8 +70,10 @@ analytics:
domain: # fill in your Matomo domain domain: # fill in your Matomo domain
cloudflare: cloudflare:
id: # fill in your Cloudflare Web Analytics token id: # fill in your Cloudflare Web Analytics token
fathom:
id: # fill in your Fathom Site ID
# Pageviews settings # Page views settings
pageviews: pageviews:
provider: # now only supports 'goatcounter' provider: # now only supports 'goatcounter'
@ -83,8 +85,8 @@ pageviews:
# #
# Available options: # Available options:
# #
# light - Use the light color scheme # light Use the light color scheme
# dark - Use the dark color scheme # dark Use the dark color scheme
# #
theme_mode: # [light | dark] theme_mode: # [light | dark]
@ -106,7 +108,7 @@ social_preview_image: # string, local or CORS resources
toc: true toc: true
comments: 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] provider: # [disqus | utterances | giscus]
# The provider options are as follows: # The provider options are as follows:
disqus: disqus:
@ -136,9 +138,9 @@ assets:
env: # [development | production] env: # [development | production]
pwa: pwa:
enabled: true # the option for PWA feature (installable) enabled: true # The option for PWA feature (installable)
cache: 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. # Paths defined here will be excluded from the PWA cache.
# Usually its value is the `baseurl` of another website that # Usually its value is the `baseurl` of another website that
# shares the same domain name as the current website. # shares the same domain name as the current website.
@ -190,10 +192,6 @@ defaults:
values: values:
layout: page layout: page
permalink: /:title/ permalink: /:title/
- scope:
path: assets/js/dist
values:
swcache: true
sass: sass:
style: compressed style: compressed

View file

@ -26,3 +26,15 @@
# - type: stack-overflow # - type: stack-overflow
# icon: 'fab fa-stack-overflow' # icon: 'fab fa-stack-overflow'
# url: '' # Fill with your stackoverflow homepage # 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

View file

@ -43,7 +43,7 @@ copyright:
meta: باستخدام :PLATFORM السمة :THEME meta: باستخدام :PLATFORM السمة :THEME
not_found: not_found:
statment: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. statement: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة.
notification: notification:
update_found: يتوفر اصدار جديد للمحتوى. update_found: يتوفر اصدار جديد للمحتوى.

View file

@ -43,7 +43,7 @@ copyright:
meta: Създадено чрез :PLATFORM и :THEME тема meta: Създадено чрез :PLATFORM и :THEME тема
not_found: not_found:
statment: Съжалявам, но на този URL адрес няма налично съдържание. statement: Съжалявам, но на този URL адрес няма налично съдържание.
notification: notification:
update_found: Налична е нова версия на съдържанието. update_found: Налична е нова версия на съдържанието.

View file

@ -43,7 +43,7 @@ copyright:
meta: Použití :PLATFORM s motivem :THEME meta: Použití :PLATFORM s motivem :THEME
not_found: 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: notification:
update_found: Je k dispozici nová verze obsahu. update_found: Je k dispozici nová verze obsahu.

View file

@ -42,7 +42,7 @@ copyright:
meta: Powered by :PLATFORM with :THEME theme meta: Powered by :PLATFORM with :THEME theme
not_found: not_found:
statment: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. statement: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource.
notification: notification:
update_found: Eine neue Version ist verfügbar. update_found: Eine neue Version ist verfügbar.

View file

@ -43,7 +43,7 @@ copyright:
meta: Αξιοποιώντας την :PLATFORM theme :THEME meta: Αξιοποιώντας την :PLATFORM theme :THEME
not_found: not_found:
statment: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. statement: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει.
notification: notification:
update_found: Υπάρχει διαθέσιμη μια νέα έκδοση του περιεχομένου. update_found: Υπάρχει διαθέσιμη μια νέα έκδοση του περιεχομένου.

View file

@ -43,7 +43,7 @@ copyright:
meta: Using the :THEME theme for :PLATFORM. meta: Using the :THEME theme for :PLATFORM.
not_found: 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: notification:
update_found: A new version of content is available. update_found: A new version of content is available.

View file

@ -43,7 +43,7 @@ copyright:
meta: Hecho con :PLATFORM usando el tema :THEME meta: Hecho con :PLATFORM usando el tema :THEME
not_found: 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: notification:
update_found: Hay una nueva versión de contenido disponible. update_found: Hay una nueva versión de contenido disponible.

View file

@ -42,7 +42,7 @@ copyright:
meta: Käytetään :PLATFORM iä Teema :THEME meta: Käytetään :PLATFORM iä Teema :THEME
not_found: 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: notification:
update_found: Uusi versio sisällöstä on saatavilla. update_found: Uusi versio sisällöstä on saatavilla.

View file

@ -43,7 +43,7 @@ copyright:
meta: Propulsé par :PLATFORM avec le thème :THEME meta: Propulsé par :PLATFORM avec le thème :THEME
not_found: 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: notification:
update_found: Une nouvelle version du contenu est disponible. update_found: Une nouvelle version du contenu est disponible.

View file

@ -45,7 +45,7 @@ copyright:
meta: Készítve :PLATFORM motorral :THEME témával meta: Készítve :PLATFORM motorral :THEME témával
not_found: 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: notification:
update_found: Elérhető a tartalom új verziója. update_found: Elérhető a tartalom új verziója.

View file

@ -43,7 +43,7 @@ copyright:
meta: Didukung oleh :PLATFORM dengan tema :THEME meta: Didukung oleh :PLATFORM dengan tema :THEME
not_found: 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: notification:
update_found: Versi konten baru tersedia. update_found: Versi konten baru tersedia.

View file

@ -42,7 +42,7 @@ copyright:
meta: Servizio offerto da :PLATFORM con tema :THEME meta: Servizio offerto da :PLATFORM con tema :THEME
not_found: 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: notification:
update_found: Nuova versione del contenuto disponibile. update_found: Nuova versione del contenuto disponibile.

View file

@ -43,7 +43,7 @@ copyright:
meta: Powered by :PLATFORM with :THEME theme meta: Powered by :PLATFORM with :THEME theme
not_found: not_found:
statment: 해당 URL은 존재하지 않습니다. statement: 해당 URL은 존재하지 않습니다.
notification: notification:
update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. update_found: 새 버전의 콘텐츠를 사용할 수 있습니다.

View file

@ -43,7 +43,7 @@ copyright:
meta: Powered by :PLATFORM with :THEME theme meta: Powered by :PLATFORM with :THEME theme
not_found: not_found:
statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ statement: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။
notification: notification:
update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။

View file

@ -43,7 +43,7 @@ copyright:
meta: Feito com :PLATFORM usando o tema :THEME meta: Feito com :PLATFORM usando o tema :THEME
not_found: not_found:
statment: Desculpe, a página não foi encontrada. statement: Desculpe, a página não foi encontrada.
notification: notification:
update_found: Uma nova versão do conteúdo está disponível. update_found: Uma nova versão do conteúdo está disponível.

View file

@ -42,7 +42,7 @@ copyright:
meta: Использует тему :THEME для :PLATFORM meta: Использует тему :THEME для :PLATFORM
not_found: not_found:
statment: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. statement: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее.
notification: notification:
update_found: Доступна новая версия контента. update_found: Доступна новая версия контента.

View file

@ -43,7 +43,7 @@ copyright:
meta: Uporabljena :PLATFORM tema :THEME #Using the :PLATFORM theme :THEME meta: Uporabljena :PLATFORM tema :THEME #Using the :PLATFORM theme :THEME
not_found: 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: notification:
update_found: Novejša različica vsebine je na voljo. #A new version of content is available. update_found: Novejša različica vsebine je na voljo. #A new version of content is available.

View file

@ -43,7 +43,7 @@ copyright:
meta: Byggd med :PLATFORM och temat :THEME meta: Byggd med :PLATFORM och temat :THEME
not_found: 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: notification:
update_found: Det finns en ny version av innehållet. update_found: Det finns en ny version av innehållet.

View file

@ -43,7 +43,7 @@ copyright:
meta: กำลังใช้ธีมของ :PLATFORM ชื่อ :THEME meta: กำลังใช้ธีมของ :PLATFORM ชื่อ :THEME
not_found: not_found:
statment: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ statement: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่
notification: notification:
update_found: มีเวอร์ชันใหม่ของเนื้อหา update_found: มีเวอร์ชันใหม่ของเนื้อหา

View file

@ -43,7 +43,7 @@ copyright:
meta: :PLATFORM ve :THEME teması meta: :PLATFORM ve :THEME teması
not_found: 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: notification:
update_found: İçeriğin yeni bir sürümü mevcut. update_found: İçeriğin yeni bir sürümü mevcut.

View file

@ -43,7 +43,7 @@ copyright:
meta: Powered by :PLATFORM with :THEME theme meta: Powered by :PLATFORM with :THEME theme
not_found: not_found:
statment: Вибачте, це посилання вказує на ресурс, що не існує. statement: Вибачте, це посилання вказує на ресурс, що не існує.
notification: notification:
update_found: Доступна нова версія вмісту. update_found: Доступна нова версія вмісту.

View file

@ -42,7 +42,7 @@ copyright:
meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME
not_found: 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: notification:
update_found: Đã có phiên bản mới của nội dung. update_found: Đã có phiên bản mới của nội dung.

View file

@ -42,7 +42,7 @@ copyright:
meta: 本站采用 :PLATFORM 主题 :THEME meta: 本站采用 :PLATFORM 主题 :THEME
not_found: not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。 statement: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
notification: notification:
update_found: 发现新版本的内容。 update_found: 发现新版本的内容。

View file

@ -42,7 +42,7 @@ copyright:
meta: 本網站使用 :PLATFORM 產生,採用 :THEME 主題 meta: 本網站使用 :PLATFORM 產生,採用 :THEME 主題
not_found: not_found:
statment: 抱歉,您可能正在存取一個已被移動的 URL或者它從未存在。 statement: 抱歉,您可能正在存取一個已被移動的 URL或者它從未存在。
notification: notification:
update_found: 發現新版本更新。 update_found: 發現新版本更新。

View file

@ -20,9 +20,9 @@ mermaid:
dayjs: dayjs:
js: js:
common: /assets/lib/dayjs/dayjs.min.js common: /assets/lib/dayjs/dayjs.min.js
locale: /assets/lib/dayjs/locale/en.min.js locale: /assets/lib/dayjs/locale/en.js
relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js relativeTime: /assets/lib/dayjs/plugin/relativeTime.js
localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.js
glightbox: glightbox:
css: /assets/lib/glightbox/glightbox.min.css css: /assets/lib/glightbox/glightbox.min.css

View file

@ -20,24 +20,24 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour
# Libraries # Libraries
toc: toc:
css: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.css css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css
js: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.js js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js
fontawesome: 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: search:
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
mermaid: 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: dayjs:
js: js:
common: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js common: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js
locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/locale/:LOCALE.min.js locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/locale/:LOCALE.js
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/relativeTime.min.js relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/relativeTime.js
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/localizedFormat.min.js localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/localizedFormat.js
glightbox: glightbox:
css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css

View file

@ -36,3 +36,15 @@ platforms:
# link: "https://fosstodon.org/" # link: "https://fosstodon.org/"
# - label: photog.social # - label: photog.social
# link: "https://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"

View file

@ -0,0 +1,7 @@
<!-- Fathom -->
<script
src="https://cdn.usefathom.com/script.js"
data-site="{{ site.analytics.fathom.id }}"
defer>
</script>
<!-- End Fathom Code -->

View file

@ -17,6 +17,12 @@
initTheme = darkTheme; 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 = { let giscusAttributes = {
src: 'https://giscus.app/client.js', src: 'https://giscus.app/client.js',
'data-repo': '{{ site.comments.giscus.repo}}', 'data-repo': '{{ site.comments.giscus.repo}}',
@ -29,7 +35,7 @@
'data-emit-metadata': '0', 'data-emit-metadata': '0',
'data-theme': initTheme, 'data-theme': initTheme,
'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}', 'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}',
'data-lang': '{{ site.comments.giscus.lang | default: lang }}', 'data-lang': lang,
'data-loading': 'lazy', 'data-loading': 'lazy',
crossorigin: 'anonymous', crossorigin: 'anonymous',
async: '' async: ''

View file

@ -6,8 +6,6 @@
<!-- layout specified --> <!-- layout specified -->
{% assign js_dist = '/assets/js/dist/' %}
{% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %}
{% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %} {% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %}
@ -62,7 +60,8 @@
{% assign js = 'commons' %} {% assign js = 'commons' %}
{% endcase %} {% endcase %}
{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %} {% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %}
<script src="{{ script | relative_url }}"></script> <script src="{{ script | relative_url }}"></script>
{% if page.math %} {% if page.math %}
@ -93,7 +92,7 @@
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
<!-- PWA --> <!-- PWA -->
{% if site.pwa.enabled %} {% if site.pwa.enabled %}
<script defer src="{{ 'app.min.js' | prepend: js_dist | relative_url }}"></script> <script defer src="{{ 'app.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
<!-- Web Analytics --> <!-- Web Analytics -->

View file

@ -1 +0,0 @@
Chirpy v<%= pkg.version %> | © 2019 <%= pkg.author %> | <%= pkg.license %> Licensed | <%= pkg.homepage %>

View file

@ -4,12 +4,57 @@
* Dependencies: https://github.com/biati-digital/glightbox * 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() { export function imgPopup() {
if (document.getElementsByClassName(IMG_CLASS).length === 0) { if (document.querySelector('.popup') === null) {
return; 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);
}
});
}
} }

View file

@ -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'); const btnSbTrigger = document.getElementById('sidebar-trigger');

View file

@ -1,3 +0,0 @@
---
permalink: /:basename
---

View file

@ -3,11 +3,23 @@ import { baseurl } from '../../_config.yml';
importScripts(`${baseurl}/assets/js/data/swconf.js`); importScripts(`${baseurl}/assets/js/data/swconf.js`);
const purge = swconf.purge; const purge = swconf.purge;
const interceptor = swconf.interceptor;
function verifyUrl(url) { 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)) { if (requestPath.startsWith(path)) {
return false; return false;
} }

View file

@ -18,16 +18,16 @@ image:
<!-- markdownlint-capture --> <!-- markdownlint-capture -->
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
# H1 - heading # H1 heading
{: .mt-4 .mb-0 } {: .mt-4 .mb-0 }
## H2 - heading ## H2 heading
{: data-toc-skip='' .mt-4 .mb-0 } {: data-toc-skip='' .mt-4 .mb-0 }
### H3 - heading ### H3 heading
{: data-toc-skip='' .mt-4 .mb-0 } {: data-toc-skip='' .mt-4 .mb-0 }
#### H4 - heading #### H4 heading
{: data-toc-skip='' .mt-4 } {: data-toc-skip='' .mt-4 }
<!-- markdownlint-restore --> <!-- markdownlint-restore -->

View file

@ -31,7 +31,7 @@ tags: [TAG] # TAG names should always be lowercase
### Timezone of Date ### 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 ### Categories and Tags
@ -147,7 +147,7 @@ _Image Caption_
#### Size #### 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 ```markdown
![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" } ![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}' %} {% 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. 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 - `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. - `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 ```liquid
{% {%
@ -318,14 +318,14 @@ If you want to embed an audio file directly, use the following syntax:
{% include embed/audio.html src='{URL}' %} {% 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. 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 - `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. - `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 ```liquid
{% {%
@ -365,7 +365,7 @@ There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They
``` ```
{: .nolineno } {: .nolineno }
### Filepath Hightlight ### Filepath Highlight
```md ```md
`/path/to/a/file.extend`{: .filepath} `/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. Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
```
## Mathematics ## 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: 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:

View file

@ -11,56 +11,74 @@ pin: true
media_subpath: '/posts/20180809' 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 <kbd>Use this template</kbd> button and then select <kbd>Create a new repository</kbd>.
3. Name the new repository `<username>.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. ### Option 2. Forking the Theme
- [**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 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 <kbd>Use this template</kbd> > <kbd>Create a new repository</kbd>, 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 `<username>.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 Dev Containers offer an isolated environment using Docker, which prevents conflicts with your system and ensures all dependencies are managed within the container.
$ bash tools/init
```
> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. **Steps**:
{: .prompt-info }
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). ### Setting up Natively (Recommended for Unix-like OS)
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.
### 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 1. Follow the [Jekyll installation guide](https://jekyllrb.com/docs/installation/) to install Jekyll and ensure [Git](https://git-scm.com/) is installed.
$ bundle 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 ## 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 <http://127.0.0.1:4000>.
### Configuration ### 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` - `url`
- `avatar` - `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
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). If you prefer to self-host the static assets, refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme) repository.
### 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 _<http://127.0.0.1:4000>_.
## Deployment ## 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. 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'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 ```console
$ bundle lock --add-platform x86_64-linux $ 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. 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-light.png){: .light .border .normal w='375' h='140' }
![Build source](pages-source-dark.png){: .dark .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. 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 ```console
$ JEKYLL_ENV=production bundle exec jekyll b $ 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/ [nodejs]: https://nodejs.org/
[starter]: https://github.com/cotes2020/chirpy-starter [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 [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

View file

@ -1,6 +1,8 @@
/* The common styles */ /* The common styles */
html { html {
font-size: 16px;
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
&:not([data-mode]), &:not([data-mode]),
&[data-mode='light'] { &[data-mode='light'] {
@ -22,8 +24,6 @@ html {
@include light-scheme; @include light-scheme;
} }
} }
font-size: 16px;
} }
body { body {
@ -42,20 +42,29 @@ body {
@extend %heading; @extend %heading;
@if $i > 1 { @if $i > 1 {
@extend %section;
@extend %anchor; @extend %anchor;
} }
@if $i < 5 { @if $i < 5 {
$factor: 0.18rem; $size-factor: 0.25rem;
@if $i == 1 { @if $i > 1 {
$factor: 0.23rem; $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 { } @else {
font-size: 1rem; font-size: 1.05rem;
} }
} }
} }
@ -80,9 +89,10 @@ img {
} }
blockquote { blockquote {
border-left: 5px solid var(--blockquote-border-color); border-left: 0.125rem solid var(--blockquote-border-color);
padding-left: 1rem; padding-left: 1rem;
color: var(--blockquote-text-color); color: var(--blockquote-text-color);
margin-top: 0.5rem;
> p:last-child { > p:last-child {
margin-bottom: 0; margin-bottom: 0;
@ -107,14 +117,14 @@ blockquote {
} }
} }
@include prompt('tip', '\f0eb', 'regular'); @include prompt('tip', '\f0eb', $fa-style: 'regular');
@include prompt('info', '\f06a'); @include prompt('info', '\f06a', $rotate: 180);
@include prompt('warning', '\f06a'); @include prompt('warning', '\f06a');
@include prompt('danger', '\f071'); @include prompt('danger', '\f071');
} }
kbd { kbd {
font-family: inherit; font-family: Lato, sans-serif;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
line-height: 1.3rem; line-height: 1.3rem;
@ -124,7 +134,7 @@ kbd {
padding-top: 0.1rem; padding-top: 0.1rem;
color: var(--kbd-text-color); color: var(--kbd-text-color);
background-color: var(--kbd-bg-color); background-color: var(--kbd-bg-color);
border-radius: 0.25rem; border-radius: $radius-sm;
border: solid 1px var(--kbd-wrap-color); border: solid 1px var(--kbd-wrap-color);
box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); box-shadow: inset 0 -2px 0 var(--kbd-wrap-color);
} }
@ -218,13 +228,13 @@ i {
#access-lastmod { #access-lastmod {
a { a {
color: inherit;
&:hover { &:hover {
@extend %link-hover; @extend %link-hover;
} }
@extend %no-bottom-border; @extend %no-bottom-border;
color: inherit;
} }
} }
@ -682,15 +692,15 @@ $btn-mb: 0.5rem;
background: var(--sidebar-bg); background: var(--sidebar-bg);
border-right: 1px solid var(--sidebar-border-color); 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 */ /* Hide scrollbar for Chrome, Safari and Opera */
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;
} }
/* Hide scrollbar for IE, Edge and Firefox */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
%sidebar-link-hover { %sidebar-link-hover {
&:hover { &:hover {
color: var(--sidebar-active-color); color: var(--sidebar-active-color);
@ -1036,6 +1046,9 @@ search {
padding-bottom: 3rem; padding-bottom: 3rem;
a { a {
font-size: 1.4rem;
line-height: 2.5rem;
&:hover { &:hover {
@extend %link-hover; @extend %link-hover;
} }
@ -1043,9 +1056,6 @@ search {
@extend %link-color; @extend %link-color;
@extend %no-bottom-border; @extend %no-bottom-border;
@extend %heading; @extend %heading;
font-size: 1.4rem;
line-height: 2.5rem;
} }
> article { > article {

View file

@ -10,17 +10,6 @@
font-family: $font-family-heading; font-family: $font-family-heading;
} }
%section {
main & {
margin-top: 2.5rem;
margin-bottom: 1.25rem;
&:focus {
outline: none; /* avoid outline in Safari */
}
}
}
%anchor { %anchor {
.anchor { .anchor {
font-size: 80%; font-size: 80%;
@ -92,7 +81,7 @@
} }
%rounded { %rounded {
border-radius: $base-radius; border-radius: $radius-lg;
} }
%img-caption { %img-caption {
@ -123,7 +112,7 @@
} }
%text-highlight { %text-highlight {
color: var(--text-muted-hightlight-color); color: var(--text-muted-highlight-color);
font-weight: 600; font-weight: 600;
} }
@ -187,7 +176,7 @@
transform: translateX(-50%); transform: translateX(-50%);
} }
@mixin prompt($type, $fa-content, $fa-style: 'solid') { @mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) {
&.prompt-#{$type} { &.prompt-#{$type} {
background-color: var(--prompt-#{$type}-bg); background-color: var(--prompt-#{$type}-bg);
@ -195,6 +184,10 @@
content: $fa-content; content: $fa-content;
color: var(--prompt-#{$type}-icon-color); color: var(--prompt-#{$type}-icon-color);
font: var(--fa-font-#{$fa-style}); font: var(--fa-font-#{$fa-style});
@if $rotate != 0 {
transform: rotate(#{$rotate}deg);
}
} }
} }
} }

View file

@ -50,13 +50,13 @@ html {
@extend %rounded; @extend %rounded;
@extend %code-snippet-bg; @extend %code-snippet-bg;
overflow: auto;
padding-bottom: 0.75rem;
@at-root figure#{&} { @at-root figure#{&} {
@extend %code-snippet-bg; @extend %code-snippet-bg;
} }
overflow: auto;
padding-bottom: 0.75rem;
pre { pre {
margin-bottom: 0; margin-bottom: 0;
font-size: $code-font-size; font-size: $code-font-size;
@ -104,7 +104,7 @@ code {
font-size: $code-font-size; font-size: $code-font-size;
padding: 3px 5px; padding: 3px 5px;
word-break: break-word; word-break: break-word;
border-radius: 4px; border-radius: $radius-sm;
background-color: var(--inline-code-bg); background-color: var(--inline-code-bg);
} }
@ -261,7 +261,7 @@ div {
.content > & { .content > & {
@include ml-mr(0); @include ml-mr(0);
border-radius: $base-radius; border-radius: $radius-lg;
} }
.code-header { .code-header {

View file

@ -16,7 +16,8 @@ $search-max-width: 200px !default;
$footer-height: 5rem !default; $footer-height: 5rem !default;
$footer-height-large: 6rem !default; /* screen width: < 850px */ $footer-height-large: 6rem !default; /* screen width: < 850px */
$main-content-max-width: 1250px !default; $main-content-max-width: 1250px !default;
$base-radius: 0.625rem !default; $radius-sm: 6px !default;
$radius-lg: 10px !default;
$back2top-size: 2.75rem !default; $back2top-size: 2.75rem !default;
/* syntax highlight */ /* syntax highlight */

View file

@ -7,7 +7,7 @@
--highlight-bg-color: #151515; --highlight-bg-color: #151515;
--highlighter-rouge-color: #c9def1; --highlighter-rouge-color: #c9def1;
--highlight-lineno-color: #808080; --highlight-lineno-color: #808080;
--inline-code-bg: #323238; --inline-code-bg: rgba(255, 255, 255, 0.05);
--code-color: #b0b0b0; --code-color: #b0b0b0;
--code-header-text-color: #6a6a6a; --code-header-text-color: #6a6a6a;
--code-header-muted-color: #353535; --code-header-muted-color: #353535;

View file

@ -8,17 +8,13 @@
--highlight-bg-color: #f6f8fa; --highlight-bg-color: #f6f8fa;
--highlighter-rouge-color: #3f596f; --highlighter-rouge-color: #3f596f;
--highlight-lineno-color: #9e9e9e; --highlight-lineno-color: #9e9e9e;
--inline-code-bg: #f6f6f7; --inline-code-bg: rgba(25, 25, 28, 0.05);
--code-color: #3a3a3a; --code-color: #3a3a3a;
--code-header-text-color: #a3a3a3; --code-header-text-color: #a3a3a3;
--code-header-muted-color: #e5e5e5; --code-header-muted-color: #e5e5e5;
--code-header-icon-color: #c9c8c8; --code-header-icon-color: #c9c8c8;
--clipboard-checked-color: #43c743; --clipboard-checked-color: #43c743;
[class^='prompt-'] {
--inline-code-bg: #fbfafa;
}
/* --- Syntax highlight theme from `rougify style github` --- */ /* --- Syntax highlight theme from `rougify style github` --- */
.highlight table td { .highlight table td {

View file

@ -11,7 +11,7 @@
/* Common color */ /* Common color */
--text-color: rgb(175, 176, 177); --text-color: rgb(175, 176, 177);
--text-muted-color: #868686; --text-muted-color: #868686;
--text-muted-hightlight-color: #aeaeae; --text-muted-highlight-color: #aeaeae;
--heading-color: #cccccc; --heading-color: #cccccc;
--label-color: #a7a7a7; --label-color: #a7a7a7;
--blockquote-border-color: rgb(66, 66, 66); --blockquote-border-color: rgb(66, 66, 66);
@ -84,27 +84,29 @@
--prompt-danger-bg: rgb(86, 28, 8, 0.8); --prompt-danger-bg: rgb(86, 28, 8, 0.8);
--prompt-danger-icon-color: #cd0202; --prompt-danger-icon-color: #cd0202;
/* tags */ /* Tags */
--tag-border: rgb(59, 79, 88); --tag-border: rgb(59, 79, 88);
--tag-shadow: rgb(32, 33, 33); --tag-shadow: rgb(32, 33, 33);
--dash-color: rgb(63, 65, 68); --dash-color: rgb(63, 65, 68);
--search-tag-bg: #292828; --search-tag-bg: #292828;
/* categories */ /* Categories */
--categories-border: rgb(64, 66, 69, 0.5); --categories-border: rgb(64, 66, 69, 0.5);
--categories-hover-bg: rgb(73, 75, 76); --categories-hover-bg: rgb(73, 75, 76);
--categories-icon-hover-color: white; --categories-icon-hover-color: white;
/* archives */ /* Archive */
--timeline-node-bg: rgb(150, 152, 156); --timeline-node-bg: rgb(150, 152, 156);
--timeline-color: rgb(63, 65, 68); --timeline-color: rgb(63, 65, 68);
--timeline-year-dot-color: var(--timeline-color); --timeline-year-dot-color: var(--timeline-color);
color-scheme: dark;
.light { .light {
display: none; display: none;
} }
/* categories */ /* Categories */
.categories.card, .categories.card,
.list-group-item { .list-group-item {
background-color: var(--card-bg); background-color: var(--card-bg);
@ -138,8 +140,6 @@
); );
} }
color-scheme: dark;
/* stylelint-disable-next-line selector-id-pattern */ /* stylelint-disable-next-line selector-id-pattern */
#disqus_thread { #disqus_thread {
color-scheme: none; color-scheme: none;

View file

@ -11,7 +11,7 @@
/* Common color */ /* Common color */
--text-color: #34343c; --text-color: #34343c;
--text-muted-color: #757575; --text-muted-color: #757575;
--text-muted-hightlight-color: inherit; --text-muted-highlight-color: inherit;
--heading-color: #2a2a2a; --heading-color: #2a2a2a;
--label-color: #585858; --label-color: #585858;
--blockquote-border-color: #eeeeee; --blockquote-border-color: #eeeeee;
@ -92,14 +92,6 @@
--tag-hover: rgb(222, 226, 230); --tag-hover: rgb(222, 226, 230);
--search-tag-bg: #f8f9fa; --search-tag-bg: #f8f9fa;
[class^='prompt-'] {
--link-underline-color: rgb(219, 216, 216);
}
.dark {
display: none;
}
/* Categories */ /* Categories */
--categories-border: rgba(0, 0, 0, 0.125); --categories-border: rgba(0, 0, 0, 0.125);
--categories-hover-bg: var(--btn-border-color); --categories-hover-bg: var(--btn-border-color);
@ -109,4 +101,12 @@
--timeline-color: rgba(0, 0, 0, 0.075); --timeline-color: rgba(0, 0, 0, 0.075);
--timeline-node-bg: #c2c6cc; --timeline-node-bg: #c2c6cc;
--timeline-year-dot-color: #ffffff; --timeline-year-dot-color: #ffffff;
[class^='prompt-'] {
--link-underline-color: rgb(219, 216, 216);
}
.dark {
display: none;
}
} /* light-scheme */ } /* light-scheme */

View file

@ -16,7 +16,7 @@
} }
.card-header { .card-header {
$radius: calc($base-radius - 1px); $radius: calc($radius-lg - 1px);
padding: 0.75rem; padding: 0.75rem;
border-radius: $radius; border-radius: $radius;

View file

@ -20,7 +20,7 @@
background: none; background: none;
%img-radius { %img-radius {
border-radius: $base-radius $base-radius 0 0; border-radius: $radius-lg $radius-lg 0 0;
} }
.preview-img { .preview-img {
@ -131,7 +131,7 @@
/* Tablet */ /* Tablet */
@media all and (min-width: 768px) { @media all and (min-width: 768px) {
%img-radius { %img-radius {
border-radius: 0 $base-radius $base-radius 0; border-radius: 0 $radius-lg $radius-lg 0;
} }
#post-list { #post-list {

View file

@ -173,12 +173,12 @@ header {
} }
&:first-child { &:first-child {
border-radius: $base-radius 0 0 $base-radius; border-radius: $radius-lg 0 0 $radius-lg;
left: 0.5px; left: 0.5px;
} }
&:last-child { &:last-child {
border-radius: 0 $base-radius $base-radius 0; border-radius: 0 $radius-lg $radius-lg 0;
right: 0.5px; right: 0.5px;
} }
} }

View file

@ -11,4 +11,4 @@ redirect_from:
{% include lang.html %} {% include lang.html %}
<p class="lead">{{ site.data.locales[lang].not_found.statment }}</p> <p class="lead">{{ site.data.locales[lang].not_found.statement }}</p>

View file

@ -22,14 +22,24 @@ const swconf = {
{% endfor %} {% endfor %}
], ],
{%- comment -%} The request url with below path will not be cached. {%- endcomment -%} interceptor: {
denyPaths: [ {%- comment -%} URLs containing the following paths will not be cached. {%- endcomment -%}
paths: [
{% for path in site.pwa.cache.deny_paths %} {% for path in site.pwa.cache.deny_paths %}
{% unless path == empty %} {% unless path == empty %}
'{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
{% endunless %} {% endunless %}
{% endfor %} {% 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 purge: false
{% else %} {% else %}
purge: true purge: true

@ -1 +1 @@
Subproject commit b9c58cf485a7dcbc833e698d67dd1850bdc93eb3 Subproject commit a231bc7e2c67198e604950cb2be9147a0b2020c0

View file

@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
"plugin_type" => "theme" "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", "~> 4.3"
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"

View file

@ -8,6 +8,7 @@
}, },
"author": "Cotes Chung", "author": "Cotes Chung",
"license": "MIT", "license": "MIT",
"since": 2019,
"bugs": { "bugs": {
"url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues"
}, },
@ -19,17 +20,18 @@
"watch:js": "rollup -c --bundleConfigAsCjs -w", "watch:js": "rollup -c --bundleConfigAsCjs -w",
"lint:scss": "stylelint _sass/**/*.scss", "lint:scss": "stylelint _sass/**/*.scss",
"lint:fix:scss": "npm run lint:scss -- --fix", "lint:fix:scss": "npm run lint:scss -- --fix",
"test": "npm run lint:scss" "test": "npm run lint:scss",
"prepare": "husky"
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3" "bootstrap": "^5.3.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.5", "@babel/core": "^7.25.2",
"@babel/plugin-transform-class-properties": "^7.24.1", "@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/preset-env": "^7.24.5", "@babel/preset-env": "^7.25.4",
"@commitlint/cli": "^19.3.0", "@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2", "@commitlint/config-conventional": "^19.2.2",
"@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
@ -39,13 +41,12 @@
"@semantic-release/exec": "^6.0.3", "@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"conventional-changelog-conventionalcommits": "^7.0.2", "conventional-changelog-conventionalcommits": "^8.0.0",
"husky": "^9.0.11", "husky": "^9.1.5",
"purgecss": "^6.0.0", "purgecss": "^6.0.0",
"rollup": "^4.17.2", "rollup": "^4.21.0",
"rollup-plugin-license": "^3.3.1", "semantic-release": "^24.1.0",
"semantic-release": "^23.1.1", "stylelint": "^16.8.2",
"stylelint": "^16.5.0",
"stylelint-config-standard-scss": "^13.1.0" "stylelint-config-standard-scss": "^13.1.0"
}, },
"prettier": { "prettier": {
@ -156,8 +157,8 @@
[ [
"@semantic-release/exec", "@semantic-release/exec",
{ {
"prepareCmd": "bash tools/release --prepare", "prepareCmd": "bash tools/release.sh --prepare",
"publishCmd": "bash tools/release" "publishCmd": "bash tools/release.sh"
} }
], ],
[ [

View file

@ -1,38 +1,48 @@
import babel from '@rollup/plugin-babel'; import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser'; import terser from '@rollup/plugin-terser';
import license from 'rollup-plugin-license';
import { nodeResolve } from '@rollup/plugin-node-resolve'; import { nodeResolve } from '@rollup/plugin-node-resolve';
import fs from 'fs';
import path from 'path';
import yaml from '@rollup/plugin-yaml'; import yaml from '@rollup/plugin-yaml';
import fs from 'fs';
import pkg from './package.json';
const SRC_DEFAULT = '_javascript'; const SRC_DEFAULT = '_javascript';
const DIST_DEFAULT = 'assets/js/dist';
const SRC_PWA = `${SRC_DEFAULT}/pwa`; 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'; const isProd = process.env.BUILD === 'production';
if (fs.existsSync(DIST_DEFAULT)) { function cleanup() {
fs.rm(DIST_DEFAULT, { recursive: true, force: true }, (err) => { fs.rmSync(DIST, { recursive: true, force: true });
if (err) { console.log(`> Directory "${DIST}" has been cleaned.`);
throw err;
}
});
} }
function build(filename, opts = {}) { function insertFrontmatter() {
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';
return { 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: { output: {
file: `${dist}/${filename}.min.js`, file: `${DIST}/${filename}.min.js`,
format: 'iife', format: 'iife',
name: 'Chirpy', name: 'Chirpy',
banner,
sourcemap: !isProd sourcemap: !isProd
}, },
watch: { watch: {
@ -46,18 +56,14 @@ function build(filename, opts = {}) {
}), }),
nodeResolve(), nodeResolve(),
yaml(), yaml(),
isProd && commentStyle === 'none' && terser(), isProd && terser(),
license({ jekyll && insertFrontmatter()
banner: {
commentStyle,
content: { file: bannerUrl }
}
}),
isProd && commentStyle !== 'none' && terser()
] ]
}; };
} }
cleanup();
export default [ export default [
build('commons'), build('commons'),
build('home'), build('home'),
@ -65,10 +71,6 @@ export default [
build('page'), build('page'),
build('post'), build('post'),
build('misc'), build('misc'),
build('app', { src: SRC_PWA }), build('app', { src: SRC_PWA, jekyll: true }),
build('sw', { build('sw', { src: SRC_PWA, jekyll: true })
src: SRC_PWA,
bannerUrl: path.join(__dirname, SRC_PWA, '_frontmatter'),
commentStyle: 'none'
})
]; ];

View file

@ -80,13 +80,13 @@ init_files() {
rm -rf .github && mkdir -p .github/workflows rm -rf .github && mkdir -p .github/workflows
mv "$temp/$ACTIONS_WORKFLOW" .github/workflows/"$ACTIONS_WORKFLOW" mv "$temp/$ACTIONS_WORKFLOW" .github/workflows/"$ACTIONS_WORKFLOW"
rm -rf "$temp" rm -rf "$temp"
## Cleanup image settings in site config
_sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml
fi fi
# Cleanup image settings in site config
_sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml
# remove the other files # remove the other files
rm -rf _posts/* rm -rf tools/init.sh tools/release.sh _posts/*
# build assets # build assets
npm i && npm run build npm i && npm run build

View file

@ -37,7 +37,7 @@ help() {
echo " 2. Merge the release branch into the default branch" echo " 2. Merge the release branch into the default branch"
echo echo
echo "Usage:" echo "Usage:"
echo " bash ./tools/release [options]" echo " bash $0 [options]"
echo echo
echo "Options:" echo "Options:"
echo " --prepare Preparation for release" echo " --prepare Preparation for release"
@ -111,13 +111,6 @@ prepare() {
## Build a Gem package ## Build a Gem package
build_gem() { 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 # Remove unnecessary theme settings
sed -i -E "s/(^timezone:).*/\1/;s/(^cdn:).*/\1/;s/(^avatar:).*/\1/" $CONFIG sed -i -E "s/(^timezone:).*/\1/;s/(^cdn:).*/\1/;s/(^avatar:).*/\1/" $CONFIG
rm -f ./*.gem rm -f ./*.gem
@ -132,14 +125,6 @@ build_gem() {
echo -e "\n> Resume file changes ...\n" echo -e "\n> Resume file changes ...\n"
git reset git reset
git checkout . 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) # Push the gem to RubyGems.org (using $GEM_HOST_API_KEY)

View file

@ -46,5 +46,9 @@ if $prod; then
command="JEKYLL_ENV=production $command" command="JEKYLL_ENV=production $command"
fi fi
if [ -e /proc/1/cgroup ] && grep -q docker /proc/1/cgroup; then
command="$command --force_polling"
fi
echo -e "\n> $command\n" echo -e "\n> $command\n"
eval "$command" eval "$command"

View file

@ -19,7 +19,7 @@ help() {
echo echo
echo "Usage:" echo "Usage:"
echo echo
echo " bash ./tools/test [options]" echo " bash $0 [options]"
echo echo
echo "Options:" echo "Options:"
echo ' -c, --config "<config_a[,config_b[...]]>" Specify config file(s)' echo ' -c, --config "<config_a[,config_b[...]]>" Specify config file(s)'