Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve font configurations for global and headings #1879

Merged
merged 1 commit into from
Sep 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ sidebar:

# Scroll percent label in b2t button
scrollpercent: false

# Enable sidebar on narrow view
onmobile: false

Expand Down Expand Up @@ -264,32 +264,46 @@ font:
global:
# external: true will load this font family from host.
external: true
# family: the font family
family: Lato
# size: the font size. Use `px` as unit
size:

# Font settings for Headlines (h1, h2, h3, h4, h5, h6)
# Fallback to `global` font settings.
headings:
# external: true will load this font family from host.
external: true
# family: the font family
family:
# size: the font size. Use `px` as unit
size:

# Font settings for posts
# Fallback to `global` font settings.
posts:
# external: true will load this font family from host.
external: true
# family: the font family
family:

# Font settings for Logo
# Fallback to `global` font settings.
# The `size` option use `px` as unit
logo:
# external: true will load this font family from host.
external: true
# family: the font family
family:
# size: the font size. Use `px` as unit
size:

# Font settings for <code> and code blocks.
codes:
# external: true will load this font family from host.
external: true
# family: the font family
family:
# size: the font size. Use `px` as unit
size:


Expand Down Expand Up @@ -330,8 +344,8 @@ changyan:
appid:
appkey:

# Valine.

# Valine.
# You can get your appid and appkey from https://leancloud.cn
# more info please open https://github.com/xCss/Valine
valine:
Expand Down
5 changes: 0 additions & 5 deletions source/css/_common/components/post/post-title.styl
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
.posts-expand .post-title {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to define variables here like font-size: $font-size-base;?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is inherited from the global h1...h6 declaration in the scaffolding part. While this one was just overriding it always with a fixed px value.

font-size: 26px;
text-align: center;
word-break: break-word;
font-weight: $posts-expand-title-font-weight

+mobile() {
font-size: 22px;
}
}
.posts-expand .post-title-link {
display: inline-block;
Expand Down
2 changes: 2 additions & 0 deletions source/css/_variables/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ $font-weight-bolder = 700

// Font size
$font-size-base = 14px
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems duplicate here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the style of the other declaration, seems a safe "default" way in stylus. Isn't it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but i think need to set 14px in config by default instead of reading $font-size-base var twice.

font:
  global:
    size: 14

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I will create another PR then to get rid of this double declarations. I saw a lot of them during the patch making.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope u know what u are doing.
Also, always remember what in NexT is 4 schemes. And if on one of them (for ex on Mist) worked well, on another scheme this can be broken. Muse and Mist have aproach structure, but Pisces is very difference from them. Gemini is mirror of Pisces with some style remakes and additions. So, please, make the tests at least on two schemes (Muse || Mist && Pisces || Gemini).

$font-size-base = unit(hexo-config('font.global.size'), px) if hexo-config('font.global.size') is a 'unit'
$font-size-small = $font-size-base - 2px
$font-size-smaller = $font-size-base - 4px
$font-size-large = $font-size-base + 2px
Expand All @@ -101,6 +102,7 @@ $font-size-larger = $font-size-base + 4px
// Headings font size
$font-size-headings-step = 2px
$font-size-headings-base = 24px
$font-size-headings-base = unit(hexo-config('font.headings.size'), px) if hexo-config('font.headings.size') is a 'unit'
$font-size-headings-small = $font-size-headings-base - $font-size-headings-step
$font-size-headings-smaller = $font-size-headings-small - $font-size-headings-step
$font-size-headings-large = $font-size-headings-base + $font-size-headings-step
Expand Down