From 62aef9f850afcbf66fe6a22a777985055d939d24 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 27 Oct 2020 22:08:04 +0800 Subject: [PATCH] Improve the SCSS code style --- assets/css/_addon/main.scss | 130 +++++++++++++++++----------------- assets/css/_addon/module.scss | 6 +- assets/css/archives.scss | 12 ++-- assets/css/categories.scss | 10 +-- assets/css/category-tag.scss | 22 +++--- assets/css/home.scss | 14 ++-- assets/css/post.scss | 26 +++---- assets/css/tags.scss | 4 +- 8 files changed, 112 insertions(+), 112 deletions(-) diff --git a/assets/css/_addon/main.scss b/assets/css/_addon/main.scss index 91b97ac..1dc79ea 100644 --- a/assets/css/_addon/main.scss +++ b/assets/css/_addon/main.scss @@ -87,7 +87,7 @@ $sidebar-display: "sidebar-display"; a { font-weight: 900; font-size: 1.5rem; - letter-spacing: .5px; + letter-spacing: 0.5px; &:hover { color: #fff; text-decoration: none; @@ -101,17 +101,17 @@ $sidebar-display: "sidebar-display"; color: #828282; line-height: 1.2rem; word-spacing: 1px; - margin: .5rem 1.5rem 2rem 1.5rem; + margin: 0.5rem 1.5rem 2rem 1.5rem; } .sidebar-bottom { .icon-border + a { // the icon behide mode-toggle - margin-left: .1rem; + margin-left: 0.1rem; } } .nav-link { border-radius: 0; - font-size: .95rem; + font-size: 0.95rem; font-weight: 600; letter-spacing: 1px; } @@ -133,8 +133,8 @@ $sidebar-display: "sidebar-display"; display: -webkit-box; display: -ms-flexbox; - >li:last-child { - >a { + > li:last-child { + > a { margin-right: -3px; max-width: calc(100% - 3px); } @@ -160,15 +160,15 @@ $sidebar-display: "sidebar-display"; $top: -$offset * $tab-height + $tab-cursor-height / 2; @if $i < $tab-count { - >li.active:nth-child(#{$i}), - >li.nav-item:nth-child(#{$i}):hover { + > li.active:nth-child(#{$i}), + > li.nav-item:nth-child(#{$i}):hover { ~li:last-child::after { @include fix-cursor($top); } } } @else { - >li.active:nth-child(#{$i}):last-child::after, - >li.nav-item:nth-child(#{$i}):last-child:hover::after { + > li.active:nth-child(#{$i}):last-child::after, + > li.nav-item:nth-child(#{$i}):last-child:hover::after { @include fix-cursor($top); } } @@ -181,7 +181,7 @@ $sidebar-display: "sidebar-display"; font-size: 1.2rem; margin: 2rem 2.5rem 1.6rem; a { - margin-bottom: .5rem; // icons may have multi lines + margin-bottom: 0.5rem; // icons may have multi lines } a:hover, #mode-toggle-wrapper > i:hover { @@ -204,7 +204,7 @@ $sidebar-display: "sidebar-display"; width: 3px; height: 3px; border-radius: 50%; - margin-top: .75rem; + margin-top: 0.75rem; } } } // #sidebar @@ -228,7 +228,7 @@ $sidebar-display: "sidebar-display"; } #avatar { - >a { + > a { display: block; width: 6rem; height: 6rem; @@ -295,7 +295,7 @@ $sidebar-display: "sidebar-display"; #breadcrumb { font-size: 1rem; color: gray; - padding-left: .5rem; + padding-left: 0.5rem; a:hover { @extend %link-hover; } @@ -323,7 +323,7 @@ $sidebar-display: "sidebar-display"; padding: 0 .5rem; i { z-index: 2; - font-size: .9rem; + font-size: 0.9rem; color: var(--search-icon-color); } .fa-times-circle { /* button 'clean up' */ @@ -341,7 +341,7 @@ $sidebar-display: "sidebar-display"; background: center; border: 0; border-radius: 0; - padding: .18rem .3rem; + padding: 0.18rem .3rem; color: var(--text-color); } @@ -366,12 +366,12 @@ $sidebar-display: "sidebar-display"; font-size: 1rem; background: var(--search-tag-bg); border: none; - padding: .5rem; + padding: 0.5rem; margin: 0 1rem 1rem 0; &::before { content: "#"; color: var(--text-muted-color); - padding-right: .2rem; + padding-right: 0.2rem; } } } @@ -388,17 +388,17 @@ $sidebar-display: "sidebar-display"; @extend %link-hover; } } - >div { + > div { max-width: 100%; &:not(:last-child) { margin-bottom: 1rem; } i { // icons color: #818182; - margin-right: .15rem; + margin-right: 0.15rem; font-size: 80%; } - >p { + > p { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; @@ -476,13 +476,13 @@ footer { font-size: 0.8rem; color: #7a7b7d; background-color: var(--footer-bg-color); - >div.d-flex { + > div.d-flex { line-height: 1.2rem; width: 95%; max-width: 1045px; border-top: 1px solid var(--main-border-color); margin-bottom: 1rem; - >div { + > div { width: 350px; } } @@ -527,13 +527,13 @@ footer { @include panel-label; } .post-content { - font-size: .9rem; + font-size: 0.9rem; } } #access-tags { - >div.post-content > div { + > div.post-content > div { max-width: 80%; } .post-tag { @@ -542,8 +542,8 @@ footer { font-size: 0.85rem; background: none; border: 1px solid var(--btn-border-color); - border-radius: .8rem; - padding: .3rem .5rem; + border-radius: 0.8rem; + padding: 0.3rem .5rem; margin: 0 .35rem .5rem 0; &:hover { background-color: #2a408e; @@ -556,7 +556,7 @@ footer { #access-lastmod { ul { - >li { + > li { height: 1.8rem; overflow: hidden; text-overflow: ellipsis; @@ -659,12 +659,12 @@ sup { } .footnotes ol { - margin-top: .5rem; - >li { - padding-top: .2rem; + margin-top: 0.5rem; + > li { + padding-top: 0.2rem; margin-top: -0.2rem; - >p { - padding-left: .2em; + > p { + padding-left: 0.2em; } &:not(:last-child) { margin-bottom: -.8rem; @@ -694,11 +694,11 @@ sup { .reversefootnote { @at-root a#{&} { - font-size: .6rem; + font-size: 0.6rem; position: absolute; line-height: 1; - padding-top: .5em; - margin-left: .5em; + padding-top: 0.5em; + margin-left: 0.5em; border-bottom-style: none !important; } } @@ -737,7 +737,7 @@ img { margin-bottom: 1rem; } em { /* MarkDown italic */ - padding-right: .2rem; + padding-right: 0.2rem; } a:hover { code { @@ -751,7 +751,7 @@ img { div.post-content .table-wrapper { overflow-x: auto; - >table { + > table { min-width: 60%; overflow-x: auto; border-spacing: 0; @@ -812,8 +812,8 @@ div.post-content .table-wrapper { word-wrap: break-word; @mixin img($caption: false) { - >img:not([style]) { - margin: .5rem 0; + > img:not([style]) { + margin: 0.5rem 0; &:not(.normal):not(.left):not(.right) { @include align-center; @@ -825,12 +825,12 @@ div.post-content .table-wrapper { &.left { float: left; - margin: .75rem 1rem 1rem 0; + margin: 0.75rem 1rem 1rem 0; } &.right { float: right; - margin: .75rem 0 1rem 1rem; + margin: 0.75rem 0 1rem 1rem; } } @@ -876,12 +876,12 @@ div.post-content .table-wrapper { min-width: 2rem; text-align: center; background: var(--tag-bg); - border-radius: .3rem; + border-radius: 0.3rem; padding: 0 .4rem; color: inherit; line-height: 1.3rem; &:not(:last-child) { - margin-right: .2rem; + margin-right: 0.2rem; } &:hover { @@ -942,7 +942,7 @@ div.post-content .table-wrapper { } .tooltip-inner { /* Overrided BS4 Tooltip */ - font-size: .7rem; + font-size: 0.7rem; max-width: 220px; text-align: left; } @@ -1005,10 +1005,10 @@ div.post-content .table-wrapper { footer { height: $footer-height; - >div.d-flex { + > div.d-flex { width: 100%; padding: 1.5rem 0; - margin-bottom: .3rem; + margin-bottom: 0.3rem; flex-wrap: wrap; justify-content: left!important; -ms-flex-pack: distribute!important; @@ -1335,14 +1335,14 @@ div.post-content .table-wrapper { #main > div.row { padding-left: calc((100% - #{$main-content-max-width}) / 2); - >div.col-xl-8 { + > div.col-xl-8 { max-width: 850px; } } #search-result-wrapper { padding-right: 2rem; - >div { + > div { max-width: 1110px; } } @@ -1367,8 +1367,8 @@ div.post-content .table-wrapper { #main > div.row > div.col-xl-8 { padding-left: 0; - >div:first-child { - padding-left: .55rem !important; + > div:first-child { + padding-left: 0.55rem !important; padding-right: 1.9rem !important; } } @@ -1401,14 +1401,14 @@ div.post-content .table-wrapper { -webkit-box-pack: normal !important; -ms-flex-pack: normal !important; justify-content: normal !important; - >a { + > a { width: 6.2rem; height: 6.2rem; } } .profile-text { - margin-left: .5rem; + margin-left: 0.5rem; /* .d-flex */ display: -webkit-box!important; display: -ms-flexbox!important; @@ -1419,7 +1419,7 @@ div.post-content .table-wrapper { /* .align-content-center */ -ms-flex-line-pack: center!important; align-content: center!important; - >div { + > div { text-align: left !important; width: 100%; } @@ -1437,12 +1437,12 @@ div.post-content .table-wrapper { .site-subtitle { word-spacing: 0; - margin: .3rem 0 0 0; + margin: 0.3rem 0 0 0; } ul { margin-left: 3%; - >li > a { + > li > a { padding-left: 2.5rem; -webkit-box-pack: start!important; -ms-flex-pack: start!important; @@ -1451,14 +1451,14 @@ div.post-content .table-wrapper { } .nav-link { - >span { + > span { letter-spacing: 3px; } - >i { + > i { @include icon-round(1.65rem); line-height: 1rem; - font-size: .6rem; - padding: .5em 0 0 .1em; + font-size: 0.6rem; + padding: 0.5em 0 0 .1em; display: inline-block!important; } } @@ -1477,22 +1477,22 @@ div.post-content .table-wrapper { i { text-align: center; width: 1.25em; - padding-top: .44rem; + padding-top: 0.44rem; } } #mode-toggle-wrapper { - font-size: .9rem; + font-size: 0.9rem; i { @include icon-round(2rem); - padding-top: .44rem; + padding-top: 0.44rem; bottom: 0; } } .icon-border { @include ml-mr(.2rem); - margin-top: .85rem; + margin-top: 0.85rem; +a { margin-left: 0; } @@ -1506,7 +1506,7 @@ div.post-content .table-wrapper { #search-result-wrapper { width: calc(100% - #{$sidebar-width-large}); - >div { + > div { max-width: #{$main-content-max-width}; } } diff --git a/assets/css/_addon/module.scss b/assets/css/_addon/module.scss index 283fe56..94505f4 100644 --- a/assets/css/_addon/module.scss +++ b/assets/css/_addon/module.scss @@ -100,14 +100,14 @@ } @mixin panel-label { + @include label(inherit); display: block; line-height: 1.2; - padding-top: .5rem; - padding-bottom: .5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; margin-top: 0; margin-bottom: 0; letter-spacing: -0.02em; - @include label(inherit); } @mixin align-center { diff --git a/assets/css/archives.scss b/assets/css/archives.scss index b13a854..db6224a 100644 --- a/assets/css/archives.scss +++ b/assets/css/archives.scss @@ -33,7 +33,7 @@ background-image: linear-gradient( to left, #fff, #fbfbfb, #fbfbfb, #fbfbfb, #fff); } - >div { + > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -111,12 +111,12 @@ } // #archives .date ul { - >li { - >div>a { + > li { + > div > a { /* post title in Archvies */ margin-left: 2.5rem; position: relative; - top: .1rem; + top: 0.1rem; } &::after { @extend %date-timeline; @@ -129,10 +129,10 @@ top: -1.61rem; } } - &:not(:last-child)>li:last-child::after { + &:not(:last-child) > li:last-child::after { height: 3.4rem; } - &:last-child>li:last-child::after { + &:last-child > li:last-child::after { display: none; } } // #archives ul diff --git a/assets/css/categories.scss b/assets/css/categories.scss index c7b7a54..a72ebe9 100644 --- a/assets/css/categories.scss +++ b/assets/css/categories.scss @@ -22,7 +22,7 @@ border-left: none; border-right: none; padding-left: 2rem; - >i { + > i { @extend %category-icon-color; } &:first-child { @@ -32,7 +32,7 @@ } - .card-header>span>i:first-child { + .card-header > span > i:first-child { @extend %category-icon-color; } @@ -50,9 +50,9 @@ border-radius: 50%; text-align: center; color: #6c757d!important; - >i.fas { + > i.fas { position: relative; - height: .7rem; + height: 0.7rem; width: 1rem; transition: 300ms ease all; } @@ -68,4 +68,4 @@ -ms-transform: rotate(-90deg); /* IE 9 */ -webkit-transform: rotate(-90deg); /* Safari 3-8 */ transform: rotate(-90deg); -} \ No newline at end of file +} diff --git a/assets/css/category-tag.scss b/assets/css/category-tag.scss index 274e58e..87c2041 100644 --- a/assets/css/category-tag.scss +++ b/assets/css/category-tag.scss @@ -10,9 +10,9 @@ {% include_relative _addon/main.scss %} #page-category, #page-tag { - ul>li { + ul > li { line-height: 1.5rem; - padding: .6rem 0; + padding: 0.6rem 0; &::before { // dot background: #999; width: 5px; @@ -21,25 +21,25 @@ display: block; content: ""; position: relative; - top: .6rem; - margin-right: .5rem; + top: 0.6rem; + margin-right: 0.5rem; } - >a { /* post's title */ + > a { /* post's title */ font-size: 1.1rem; @extend %no-bottom-border; } - >span:last-child { + > span:last-child { white-space: nowrap; } /* post's date */ } } -#page-tag h1>i { // tag icon +#page-tag h1 > i { // tag icon font-size: 1.2rem; } -#page-category h1>i { +#page-category h1 > i { font-size: 1.25rem; } @@ -59,15 +59,15 @@ a:hover { @media all and (max-width: 576px) { #page-category, #page-tag { - ul>li { + ul > li { &::before { margin: 0 .5rem; } - >a { + > a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } } } -} \ No newline at end of file +} diff --git a/assets/css/home.scss b/assets/css/home.scss index 50a275d..0cbf7e5 100644 --- a/assets/css/home.scss +++ b/assets/css/home.scss @@ -10,7 +10,7 @@ #post-list { margin-top: 1rem; - padding-right: .5rem; + padding-right: 0.5rem; .post-preview { padding-top: 1.5rem; @@ -21,13 +21,13 @@ font-size: 1.4rem; margin: 0; ~i { // pinned icon - font-size: .86rem; + font-size: 0.86rem; } } .post-meta { i { - font-size: .73rem; + font-size: 0.73rem; &:not(:first-child) { // post-meta icons on the homepage margin-left: 1.5rem; } @@ -35,8 +35,8 @@ } .post-content { - margin-top: .6rem; - margin-bottom: .6rem; + margin-top: 0.6rem; + margin-bottom: 0.6rem; color: var(--post-list-text-color); >p { /* Make preview shorter on the homepage */ @@ -128,7 +128,7 @@ } .pagination { - font-size: .85rem; + font-size: 0.85rem; .page-item .page-link { width: 2.2rem; height: 2.2rem; @@ -142,4 +142,4 @@ #post-list { padding-right: 0; } -} \ No newline at end of file +} diff --git a/assets/css/post.scss b/assets/css/post.scss index 8a57d8e..77a6eec 100644 --- a/assets/css/post.scss +++ b/assets/css/post.scss @@ -89,20 +89,20 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; p { font-size: 1.1rem; line-height: 1.5rem; - margin-top: .3rem; + margin-top: 0.3rem; white-space: normal; } a, span { &::before { color: var(--text-muted-color); - font-size: .65rem; + font-size: 0.65rem; text-transform: uppercase; } &:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; - left: .5px; + left: 0.5px; &::before { content: $prompt-older } @@ -110,7 +110,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; &:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; - right: .5px; + right: 0.5px; &::before { content: $prompt-newer } @@ -148,8 +148,8 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; #toc li>a { line-height: 1rem; - padding-top: .5rem; - padding-bottom: .5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; } @@ -181,8 +181,8 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; } p { - font-size: .9rem; - margin-bottom: .5rem; + font-size: 0.9rem; + margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; @@ -233,7 +233,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; font-size: 1.2rem; a { &:not(:last-child) { - margin-right: .25rem; + margin-right: 0.25rem; } &:hover { text-decoration: none; @@ -243,7 +243,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; } } >i { - padding-top: .35rem; + padding-top: 0.35rem; &:hover { @extend %btn-share-hovor; } @@ -291,7 +291,7 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; font-weight: 400; } span:last-child { - font-size: .85rem; + font-size: 0.85rem; } } // .license-wrapper @@ -320,8 +320,8 @@ $prompt-newer: "{{ site.data.label.post.button.next }}"; content: "\2022"; color: rgba(158, 158, 158, 0.8); font-weight: bold; - padding-left: .5rem; - padding-right: .3rem; + padding-left: 0.5rem; + padding-right: 0.3rem; } &.flex-column { -webkit-box-orient: horizontal!important; diff --git a/assets/css/tags.scss b/assets/css/tags.scss index 0b708fb..e8e4f8c 100644 --- a/assets/css/tags.scss +++ b/assets/css/tags.scss @@ -12,7 +12,7 @@ .tag { border-radius: 0.7em; padding: 6px 8px 7px; - margin-right: .8rem; + margin-right: 0.8rem; line-height: 3rem; letter-spacing: 0; border: 1px solid var(--tag-border) !important; @@ -22,4 +22,4 @@ font-size: 0.7em; font-family: 'Oswald', sans-serif; } -} \ No newline at end of file +}