_.
+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)'