Improve code style

- js/css
- markdown
- shell
This commit is contained in:
Cotes Chung 2021-01-27 20:06:31 +08:00
parent d8a42d9bb4
commit 8e84c6b9d6
14 changed files with 961 additions and 917 deletions

View file

@ -81,9 +81,6 @@ $ bundle info --path jekyll-theme-chirpy
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork From GitHub ### Fork From GitHub
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local. [Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
@ -114,7 +111,6 @@ What it does is:
3. Automatically create a commit to save the changes. 3. Automatically create a commit to save the changes.
## Usage ## Usage
### Configuration ### Configuration
@ -158,11 +154,8 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build: Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. 1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site. 2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your Jekyll site by: And then publish your Jekyll site by:
@ -197,7 +190,6 @@ $ docker run -it --rm \
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server. Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
## Documentation ## Documentation
For more details and the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). For more details and the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
@ -212,11 +204,9 @@ This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Boot
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation. :tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation.
Also, thank [JetBrains][JB] for providing the open source license. Also, thank [JetBrains][jb] for providing the open source license.
[![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][JB] [![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][jb]
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
## Supporting ## Supporting
@ -225,3 +215,8 @@ If you enjoy this theme or find it helpful, please consider becoming my sponsor,
## License ## License
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License. This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]:https://www.jetbrains.com/?from=jekyll-theme-chirpy

View file

@ -48,9 +48,6 @@ $ bundle info --path jekyll-theme-chirpy
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem. Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### Fork From GitHub ### Fork From GitHub
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local. [Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
@ -125,11 +122,8 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
Quickly check the files needed for GitHub Actions build: Quickly check the files needed for GitHub Actions build:
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. 1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site. 2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub. Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
And then publish your Jekyll site by: And then publish your Jekyll site by:

View file

@ -16,10 +16,10 @@ This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme bas
First, you need to setup your account on Google analytics. While your create your account, you must create your first **Property** as well. First, you need to setup your account on Google analytics. While your create your account, you must create your first **Property** as well.
1. Head to <https://analytics.google.com/> and click on **Start Measuring** 1. Head to <https://analytics.google.com/> and click on **Start Measuring**
2. Enter your desired *Account Name* and choose the desired checkboxes 2. Enter your desired _Account Name_ and choose the desired checkboxes
3. Enter your desired *Property Name*. This is the name of the tracker project that appears on your Google Analytics dashboard 3. Enter your desired _Property Name_. This is the name of the tracker project that appears on your Google Analytics dashboard
4. Enter the required information *About your business* 4. Enter the required information _About your business_
5. Hit *Create* and accept any license popup to setup your Google Analytics account and create your property 5. Hit _Create_ and accept any license popup to setup your Google Analytics account and create your property
### Create Data Stream ### Create Data Stream
@ -75,9 +75,9 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
8. Click on **Enable APIs and Services** button on the top 8. Click on **Enable APIs and Services** button on the top
9. Enable the following APIs: *Google Analytics API* 9. Enable the following APIs: _Google Analytics API_
10. On the left, Click on *OAuth Consent Screen* and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under *Publishing Status* 10. On the left, Click on _OAuth Consent Screen_ and accept **Configure Consent Screen**. Select **External** since your blog is probably hosted for the public. Click on **Publish** under _Publishing Status_
11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth` 11. Click on **Credentials** on the left and create a new **OAuth Client IDs** credential. Make sure to add a entry under `Authorized redirect URIs` that matches: `https://<project-id>.<region>.r.appspot.com/admin/auth`
@ -116,7 +116,8 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local. 1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file: 2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
```diff
```yaml
-application: your-project-id -application: your-project-id
-version: 1 -version: 1
``` ```
@ -143,6 +144,7 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
# XSRF Settings # XSRF Settings
XSRF_KEY = 'OnceUponATimeThereLivedALegend' XSRF_KEY = 'OnceUponATimeThereLivedALegend'
``` ```
**Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL. **Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
5. From inside the src/ directory, deploy the app 5. From inside the src/ directory, deploy the app
@ -194,16 +196,13 @@ Head to `https://PROJECT_ID.REGION_ID.r.appspot.com/admin` and create a query af
The query parameters are as follows: The query parameters are as follows:
- **start-date**: fill in the first day of blog posting - **start-date**: fill in the first day of blog posting
- **end-date**: fill in `today` (this is a parameter supported by GA Report, which means that it will always end according to the current query date) - **end-date**: fill in `today` (this is a parameter supported by GA Report, which means that it will always end according to the current query date)
- **metrics**: select `ga:pageviews` - **metrics**: select `ga:pageviews`
- **dimensions**: select `ga:pagePath` - **dimensions**: select `ga:pagePath`
In order to reduce the returned results and reduce the network bandwidth, we add custom filtering rules [^ga-filters]: In order to reduce the returned results and reduce the network bandwidth, we add custom filtering rules [^ga-filters]:
- **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=` - **filters**: fill in `ga:pagePath=~^/posts/.*/$;ga:pagePath!@=`.
Among them, `;` means using _logical AND_ to concatenate two rules. Among them, `;` means using _logical AND_ to concatenate two rules.
@ -224,6 +223,7 @@ Once all the hard part is done, it is very easy to enable the Page View on Chirp
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following: Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
```yaml ```yaml
google_analytics: google_analytics:
id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID

File diff suppressed because it is too large Load diff

View file

@ -100,6 +100,7 @@
@mixin panel-label { @mixin panel-label {
@include label(inherit); @include label(inherit);
display: block; display: block;
line-height: 1.2; line-height: 1.2;
padding-top: 0.5rem; padding-top: 0.5rem;

View file

@ -6,17 +6,18 @@
* MIT Licensed * MIT Licensed
*/ */
@import "colors/light-typography"; @import
@import "colors/dark-typography"; "colors/light-typography",
"colors/dark-typography",
@import "addon/module"; "addon/module",
@import "addon/variables"; "addon/variables",
@import 'addon/syntax'; "addon/syntax",
@import "addon/commons"; "addon/commons",
@import "layout/home"; "layout/home",
@import "layout/post"; "layout/post",
@import "layout/tags"; "layout/tags",
@import "layout/archives"; "layout/archives",
@import "layout/categories"; "layout/categories",
@import "layout/category-tag"; "layout/category-tag";

View file

@ -14,34 +14,12 @@
#archives { #archives {
letter-spacing: 0.03rem; letter-spacing: 0.03rem;
li {
font-size: 1.1rem;
line-height: 3rem;
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(
to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
> div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
span.lead { span.lead {
font-size: 1.5rem; font-size: 1.5rem;
position: relative; position: relative;
left: 8px; left: 8px;
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
&::after { /* Year dot */ &::after { /* Year dot */
content: ""; content: "";
display: block; display: block;
@ -59,8 +37,64 @@
box-shadow: 0 0 2px 0 #c2c6cc; box-shadow: 0 0 2px 0 #c2c6cc;
z-index: 1; z-index: 1;
} }
&:not(:first-child) {
position: relative;
left: 4px;
&::after {
left: 67px;
}
}
} // #archives span.lead } // #archives span.lead
ul {
li {
font-size: 1.1rem;
line-height: 3rem;
div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
}
&:nth-child(odd) {
background-color: var(--main-wrapper-bg, #fff);
background-image: linear-gradient(to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff);
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
.date { .date {
white-space: nowrap; white-space: nowrap;
display: inline-block; display: inline-block;
@ -97,36 +131,8 @@
} }
} // #archives .date } // #archives .date
ul {
> li {
> div > a {
/* post title in Archvies */
margin-left: 2.5rem;
position: relative;
top: 0.1rem;
}
&::after {
@extend %date-timeline;
height: 2.8rem;
top: -1.3rem;
}
&:first-child::before {
@extend %date-timeline;
height: 3.06rem;
top: -1.61rem;
}
}
&:not(:last-child) > li:last-child::after {
height: 3.4rem;
}
&:last-child > li:last-child::after {
display: none;
}
} // #archives ul
} // #archives } // #archives
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
#archives { #archives {
margin-top: -1rem; margin-top: -1rem;

View file

@ -11,6 +11,14 @@
.card-header { .card-header {
padding-right: 12px; padding-right: 12px;
} }
i {
&.far,
&.fas {
font-size: 86%; // fontawesome icons
}
}
.list-group-item { .list-group-item {
border-left: none; border-left: none;
border-right: none; border-right: none;
@ -29,12 +37,6 @@
@extend %category-icon-color; @extend %category-icon-color;
} }
i {
&.far, &.fas {
font-size: 86%; // fontawesome icons
}
}
} // .categories } // .categories
.category-trigger { .category-trigger {

View file

@ -2,10 +2,17 @@
Style for page Category and Tag Style for page Category and Tag
*/ */
#page-category, #page-tag { .dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
#page-category,
#page-tag {
ul > li { ul > li {
line-height: 1.5rem; line-height: 1.5rem;
padding: 0.6rem 0; padding: 0.6rem 0;
&::before { // dot &::before { // dot
background: #999; background: #999;
width: 5px; width: 5px;
@ -17,14 +24,16 @@
top: 0.6rem; top: 0.6rem;
margin-right: 0.5rem; margin-right: 0.5rem;
} }
> a { /* post's title */ > a { /* post's title */
font-size: 1.1rem;
@extend %no-bottom-border; @extend %no-bottom-border;
font-size: 1.1rem;
} }
> span:last-child { > span:last-child {
white-space: nowrap; white-space: nowrap;
} } /* post's date */
/* post's date */
} }
} }
@ -36,22 +45,19 @@
font-size: 1.25rem; font-size: 1.25rem;
} }
#page-category,
#page-tag,
#access-lastmod {
a:hover { a:hover {
#page-category &,
#page-tag &,
#access-lastmod & {
@extend %link-hover; @extend %link-hover;
margin-bottom: -1px; // Avoid jumping margin-bottom: -1px; // Avoid jumping
} }
} }
.dash {
margin: 0 .5rem .6rem .5rem;
border-bottom: 2px dotted var(--dash-color);
}
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
#page-category, #page-tag { #page-category,
#page-tag {
ul > li { ul > li {
&::before { &::before {
margin: 0 .5rem; margin: 0 .5rem;

View file

@ -2,6 +2,60 @@
Style for Homepage Style for Homepage
*/ */
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color);
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
#post-list { #post-list {
margin-top: 1rem; margin-top: 1rem;
padding-right: 0.5rem; padding-right: 0.5rem;
@ -11,6 +65,10 @@
padding-bottom: 1rem; padding-bottom: 1rem;
border-bottom: 1px solid var(--main-border-color); border-bottom: 1px solid var(--main-border-color);
a:hover {
@extend %link-hover;
}
h1 { h1 {
font-size: 1.4rem; font-size: 1.4rem;
margin: 0; margin: 0;
@ -55,60 +113,6 @@
} // #post-list } // #post-list
.pagination {
font-size: 1rem;
a:hover {
text-decoration: none;
}
.page-item {
.page-link {
color: var(--btn-patinator-text-color);
width: 2.5rem;
height: 2.5rem;
padding: 0;
text-align: center;
display: -webkit-box;
display: flex;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
border-radius: 50%;
border: 1px solid var(--btn-paginator-border-color);
font-family: 'Lato', sans-serif;
background-color: var(--button-bg);
&:hover {
background-color: var(--btn-paginator-hover-color)
}
}
&.active {
.page-link {
background-color: var(--btn-active-bg);
border-color: var(--btn-active-border-color);
box-shadow: 0 0 8px 0 var(--btn-paginator-shadow) !important;
color: var(--btn-text-color);
}
}
&.disabled {
cursor: not-allowed;
.page-link {
color: rgba(108, 117, 125, 0.57);
border-color: var(--btn-paginator-border-color);
background-color: var(--button-bg);
}
}
&:first-child .page-link,
&:last-child .page-link {
border-radius: 50%;
}
&:not(:last-child) {
margin-right: 0.7rem;
}
} // .page-item
} // .pagination
/* Hide SideBar and TOC */ /* Hide SideBar and TOC */
@media all and (max-width: 830px) { @media all and (max-width: 830px) {
.pagination { .pagination {

View file

@ -41,9 +41,10 @@
.post-content { .post-content {
.preview-img { .preview-img {
@include align-center;
margin-top: 0; margin-top: 0;
margin-bottom: 2.5rem; margin-bottom: 2.5rem;
@include align-center;
} }
} }
@ -63,6 +64,7 @@
.btn { .btn {
@include btn-post-nav; @include btn-post-nav;
color: var(--link-color); color: var(--link-color);
&:hover { &:hover {
background: #2a408e; background: #2a408e;
@ -71,6 +73,7 @@
} }
&.disabled { &.disabled {
@include btn-post-nav; @include btn-post-nav;
pointer-events: auto; pointer-events: auto;
cursor: not-allowed; cursor: not-allowed;
background: none; background: none;
@ -145,7 +148,6 @@
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
/* --- Related Posts --- */ /* --- Related Posts --- */
#related-posts { #related-posts {
@ -222,6 +224,11 @@
.share-wrapper { .share-wrapper {
vertical-align: middle; vertical-align: middle;
user-select: none; user-select: none;
i {
font-weight: 400;
}
.share-icons { .share-icons {
font-size: 1.2rem; font-size: 1.2rem;
a { a {
@ -243,7 +250,7 @@
} }
.fab { .fab {
&.fa-twitter { &.fa-twitter {
@include btn-sharing-color(rgba(29, 161, 242, 1.00)); @include btn-sharing-color(rgba(29, 161, 242, 1));
} }
&.fa-facebook-square { &.fa-facebook-square {
@include btn-sharing-color(rgb(66, 95, 156)); @include btn-sharing-color(rgb(66, 95, 156));
@ -264,9 +271,9 @@
} // .share-wrapper } // .share-wrapper
.share-label { .share-label {
@include label(inherit, 400, inherit); @include label(inherit, 400, inherit);
&::after { &::after {
content: ":"; content: ":";
} }
@ -280,15 +287,12 @@
@extend %link-hover; @extend %link-hover;
} }
} }
i {
font-weight: 400;
}
span:last-child { span:last-child {
font-size: 0.85rem; font-size: 0.85rem;
} }
} // .license-wrapper } // .license-wrapper
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
.post-tail-bottom { .post-tail-bottom {
-ms-flex-wrap: wrap-reverse !important; -ms-flex-wrap: wrap-reverse !important;
@ -301,8 +305,8 @@
.post-content > div[class^='language-'] { .post-content > div[class^='language-'] {
@include ml-mr(-1.25rem); @include ml-mr(-1.25rem);
border-radius: 0;
border-radius: 0;
&::before { // the lang badge &::before { // the lang badge
right: 1rem; right: 1rem;
} }

View file

@ -86,9 +86,6 @@ $ bundle info --path jekyll-theme-chirpy
或者你可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。 或者你可以 [使用 starter template][use-starter] 来快速创建 Jekyll 站点,以省去复制主题 gem 文件的时间。
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
### 在 GitHub 上 Fork ### 在 GitHub 上 Fork
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) 然后克隆到本地。 [Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) 然后克隆到本地。
@ -159,9 +156,10 @@ $ docker run -it --rm \
由于安全原因GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用插件去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。 由于安全原因GitHub Pages 的构建强制加了 `safe`参数,这导致了我们不能使用插件去创建所需的附加页面。因此,我们可以使用 GitHub Actions 去构建站点,把站点文件存储在一个新分支上,再指定该分支作为 Pages 服务的源。
确保你的 Jekyll 站点存在文件 `/.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和你的仓库默认分支名相同。 快速检查 GitHub Actions 构建需要的文件:
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook 1. 确保你的 Jekyll 站点存在文件 `/.github/workflows/pages-deploy.yml`。没有的话,新建并填入[示例工作流][workflow]的内容, 注意参数 `on.push.branches` 的值必须和你的仓库默认分支名相同。
2. 检查你的 Jekyll 站点是否有文件 `/tools/test.sh``/tools/deploy.sh`. 没有的话, 从本仓库拷贝到你的 Jekyll 项目.
在 GitHub 把你的仓库命名为 `<GH-USERNAME>.github.io`,然后: 在 GitHub 把你的仓库命名为 `<GH-USERNAME>.github.io`,然后:
@ -209,11 +207,9 @@ $ docker run -it --rm \
:tada: 感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR) 的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。 :tada: 感谢所有参与代码贡献的小伙伴, 他们的 GayHub ID 在这个[列表](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors)。 另外, 提交过 issues(或者未被合并 PR) 的高富帅和白富美也不会被遗忘,他/她们帮助报告 bug、分享新点子或者启发了我写出更通俗易懂的文档。
还有,感谢 [JetBrains][JB] 提供开源 License 还有,感谢 [JetBrains][jb] 提供开源 License
[![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][JB] [![JB-logo](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/jetbrains.svg)][jb]
[JB]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
## 赞助 ## 赞助
@ -222,3 +218,8 @@ $ docker run -it --rm \
## 许可证书 ## 许可证书
本项目开源,基于 [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) 许可。 本项目开源,基于 [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) 许可。
[starter]: https://github.com/cotes2020/chirpy-starter
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
[workflow]:https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
[jb]:https://www.jetbrains.com/?from=jekyll-theme-chirpy

View file

@ -12,7 +12,6 @@ const fs = require('fs');
const JS_ROOT = './assets/js'; const JS_ROOT = './assets/js';
const jsDest = `${ JS_ROOT }/dist/`; const jsDest = `${ JS_ROOT }/dist/`;
const copyrightPath = `${ JS_ROOT }/.copyright`;
function concatJs(files, output) { function concatJs(files, output) {
return src(files) return src(files)
@ -23,7 +22,7 @@ function concatJs(files, output) {
function minifyJs() { function minifyJs() {
return src(`${ jsDest }/*.js`) return src(`${ jsDest }/*.js`)
.pipe(insert.prepend(fs.readFileSync(copyrightPath, 'utf8'))) .pipe(insert.prepend(fs.readFileSync(`${ JS_ROOT }/.copyright`, 'utf8')))
.pipe(uglify({output: {comments: /^!|@preserve|@license|@cc_on/i}})) .pipe(uglify({output: {comments: /^!|@preserve|@license|@cc_on/i}}))
.pipe(dest(jsDest)); .pipe(dest(jsDest));
} }

View file

@ -21,15 +21,15 @@ NODE_META="package.json"
bump_assets() { bump_assets() {
_version="$1" _version="$1"
for i in ${!ASSETS[@]}; do for i in "${!ASSETS[@]}"; do
sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" ${ASSETS[$i]} sed -i "s/v[[:digit:]]\.[[:digit:]]\.[[:digit:]]/v$_version/" "${ASSETS[$i]}"
done done
gulp gulp
} }
bump_gemspec() { bump_gemspec() {
sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" $GEM_SPEC sed -i "s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/$1/" "$GEM_SPEC"
} }
bump_node() { bump_node() {
@ -39,9 +39,9 @@ bump_node() {
} }
bump() { bump() {
bump_assets $1 bump_assets "$1"
bump_gemspec $1 bump_gemspec "$1"
bump_node $1 bump_node "$1"
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
git add . git add .