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): import material icons as vendors #401

Merged
merged 1 commit into from
Jun 20, 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
3 changes: 3 additions & 0 deletions _config.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ img:
# family: the font-family which will be used in the theme
# host: uri of fonts host.
# Available value of "host": google | baomitu | ustc | custom
# When you configured 'use' as 'custom', you should fill in the value of 'custom_font_host', which should be a mirror of google fonts.
fonts:
family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif
use: google
Expand Down Expand Up @@ -265,3 +266,5 @@ vendors:
mathjax:
# Prettify r298 (only prettify.js)
prettify:
# Material Icons 3.0.1
material_icons:
18 changes: 13 additions & 5 deletions layout/_partial/config_font.ejs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<!-- Import Roboto -->
<% 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 {
Expand All @@ -32,13 +30,23 @@
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')
}
</style>
<% } %>

<!-- Import Material Icon -->
<% if(theme.vendors.material_icons) { %>
<%- cssLsload({path:(theme.vendors.material_icons),key:'material_icons'}) %>
<% } else { %>
<style>
@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')
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(<%- config.url %>fonts/MaterialIcons-Regular.woff2) format('woff2'),
url(<%- config.url %>fonts/MaterialIcons-Regular.woff) format('woff'),
url(<%- config.url %>fonts/MaterialIcons-Regular.ttf) format('truetype');
}
</style>
<% } %>