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

feat(fonts): refactor and add support for customize #332

Merged
merged 1 commit into from
Apr 30, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions _config.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ img:
# Custom Fonts
# family: the font-family which will be used in the theme
# host: uri of fonts host.
# Available value of "host": google | baomitu
# Available value of "host": google | baomitu | ustc | custom
fonts:
family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif
host: google
#host: baomitu
use: google
custom_font_host:

# Card Elevation Level
card_elevation: 2
Expand Down
3 changes: 1 addition & 2 deletions layout/_partial/config_css.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,4 @@
<% } %>

<!-- Import Font -->

<%- partial('_widget/font-' + theme.fonts.host) %>
<%- partial('_partial/config_font') %>
44 changes: 44 additions & 0 deletions layout/_partial/config_font.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<% if(theme.fonts.use === "google") { %>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet">
<% } else if(theme.fonts.use === "ustc") { %>
<link href="https://fonts.proxy.ustclug.org/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="https://fonts.proxy.ustclug.org/icon?family=Material+Icons"rel="stylesheet">
<% } else if(theme.fonts.use === "custom") { %>
<link href="<%= theme.fonts.custom_font_host %>/css?family=Roboto:300,400,500" rel="stylesheet">
<link href="<%= theme.fonts.custom_font_host %>/icon?family=Material+Icons"rel="stylesheet">
<% } else if(theme.fonts.use === "baomitu") { %>
<style>
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 300;
src: url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.eot);
src: local('Roboto'),local('Roboto-Normal'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.eot?#iefix) format('embedded-opentype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.woff2) format('woff2'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.woff) format('woff'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.ttf) format('truetype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-300.svg#Roboto) format('svg')
}

@font-face {
font-family: Roboto;
font-style: normal;
font-weight: regular;
src: url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.eot);
src: local('Roboto'),local('Roboto-Normal'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.eot?#iefix) format('embedded-opentype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.woff2) format('woff2'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.woff) format('woff'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.ttf) format('truetype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-regular.svg#Roboto) format('svg')
}

@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 500;
src: url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.eot);
src: local('Roboto'),local('Roboto-Normal'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.eot?#iefix) format('embedded-opentype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.woff2) format('woff2'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.woff) format('woff'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.ttf) format('truetype'),url(https://lib.baomitu.com/fonts/roboto/roboto-v15-latin-500.svg#Roboto) format('svg')
}

@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://lib.baomitu.com/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.eot);
src: url(https://lib.baomitu.com/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.woff2) format('woff2'),url(https://lib.baomitu.com/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.woff) format('woff'),url(https://lib.baomitu.com/material-design-icons/3.0.1/iconfont/MaterialIcons-Regular.ttf) format('truetype')
}
</style>
<% } %>
33 changes: 0 additions & 33 deletions layout/_widget/font-baomitu.ejs

This file was deleted.

2 changes: 0 additions & 2 deletions layout/_widget/font-google.ejs

This file was deleted.