From 8e36a302cec6df297c00be4555ea0a6d8bd20114 Mon Sep 17 00:00:00 2001 From: olOwOlo <26087907+olOwOlo@users.noreply.github.com> Date: Tue, 12 Sep 2017 20:23:37 +0800 Subject: refactor: store iconfont file locally --- src/css/_iconfont.scss | 110 +++++++++++++++++++++++++++++++++++++++ src/css/_partial/_iconfont.scss | 102 ------------------------------------ src/css/style.scss | 2 +- src/fonts/iconfont/iconfont.eot | Bin 0 -> 5928 bytes src/fonts/iconfont/iconfont.svg | 93 +++++++++++++++++++++++++++++++++ src/fonts/iconfont/iconfont.ttf | Bin 0 -> 5760 bytes src/fonts/iconfont/iconfont.woff | Bin 0 -> 4160 bytes src/webpack.config.js | 8 ++- 8 files changed, 211 insertions(+), 104 deletions(-) create mode 100644 src/css/_iconfont.scss delete mode 100644 src/css/_partial/_iconfont.scss create mode 100644 src/fonts/iconfont/iconfont.eot create mode 100644 src/fonts/iconfont/iconfont.svg create mode 100644 src/fonts/iconfont/iconfont.ttf create mode 100644 src/fonts/iconfont/iconfont.woff (limited to 'src') diff --git a/src/css/_iconfont.scss b/src/css/_iconfont.scss new file mode 100644 index 0000000..03efae6 --- /dev/null +++ b/src/css/_iconfont.scss @@ -0,0 +1,110 @@ +// ============================== +// Iconfont +// ============================== + +@font-face { + font-family: 'iconfont'; /* project id 96542 */ + + src: url('../fonts/iconfont/iconfont.eot'); + src: url('../fonts/iconfont/iconfont.eot#iefix') format('embedded-opentype'), // not '?#iefix', because webpack will add '?hash=[hash]' + url('../fonts/iconfont/iconfont.woff') format('woff'), + url('../fonts/iconfont/iconfont.ttf') format('truetype'), + url('../fonts/iconfont/iconfont.svg#iconfont') format('svg'); + + // Uncomment these code and comment upper code if you want to use alicdn + // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot'); + // src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot?#iefix') format('embedded-opentype'), + // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.woff') format('woff'), + // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.ttf') format('truetype'), + // url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.svg#iconfont') format('svg'); +} + +.iconfont { + font-family: "iconfont" !important; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; + cursor: pointer; +} + +.icon-instagram:before { + font-size: .95em; + content: "\e611"; + position: relative; + top: -1px; +} +.icon-douban:before { + content: "\e610"; +} +.icon-tumblr:before { + content: "\e69f"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-linkedin:before { + content: "\e60d"; + position: relative; + top: -4px; +} +.icon-twitter:before { + content: "\e600"; +} +.icon-weibo:before { + content: "\e602"; +} +.icon-stack-overflow:before { + content: "\e603"; + font-size: .85em; + position: relative; + top: -4px; +} +.icon-email:before { + content: "\e605"; + position: relative; + top: -2px; +} +.icon-facebook:before { + content: "\e601"; + font-size: .95em; + position: relative; + top: -2px; +} +.icon-github:before { + content: "\e606"; + position: relative; + top: -3px; +} +.icon-rss:before { + content: "\e604"; +} +.icon-google:before { + content: "\e609"; +} +.icon-zhihu:before { + content: "\e607"; + font-size: .9em; + position: relative; + top: -2px; +} +.icon-pocket:before { + content: "\e856"; +} + +/* Generic Icon */ +.icon-heart:before { + content: "\e608"; +} +.icon-right:before { + content: "\e60a"; +} +.icon-left:before { + content: "\e60b"; +} +.icon-up:before { + content: "\e60c"; +} +.icon-close:before { + content: "\e60f"; +} diff --git a/src/css/_partial/_iconfont.scss b/src/css/_partial/_iconfont.scss deleted file mode 100644 index cf8c967..0000000 --- a/src/css/_partial/_iconfont.scss +++ /dev/null @@ -1,102 +0,0 @@ -// ============================== -// Iconfont -// ============================== - -@font-face { - font-family: 'iconfont'; /* project id 96542 */ - src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot'); - src: url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.eot?#iefix') format('embedded-opentype'), - url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.woff') format('woff'), - url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.ttf') format('truetype'), - url('//at.alicdn.com/t/font_96542_ixz9jngnf1sb57b9.svg#iconfont') format('svg'); -} - -.iconfont { - font-family: "iconfont" !important; - font-style: normal; - -webkit-font-smoothing: antialiased; - -webkit-text-stroke-width: 0.2px; - -moz-osx-font-smoothing: grayscale; - cursor: pointer; -} - -.icon-instagram:before { - font-size: .95em; - content: "\e611"; - position: relative; - top: -1px; -} -.icon-douban:before { - content: "\e610"; -} -.icon-tumblr:before { - content: "\e69f"; - font-size: .85em; - position: relative; - top: -4px; -} -.icon-linkedin:before { - content: "\e60d"; - position: relative; - top: -4px; -} -.icon-twitter:before { - content: "\e600"; -} -.icon-weibo:before { - content: "\e602"; -} -.icon-stack-overflow:before { - content: "\e603"; - font-size: .85em; - position: relative; - top: -4px; -} -.icon-email:before { - content: "\e605"; - position: relative; - top: -2px; -} -.icon-facebook:before { - content: "\e601"; - font-size: .95em; - position: relative; - top: -2px; -} -.icon-github:before { - content: "\e606"; - position: relative; - top: -3px; -} -.icon-rss:before { - content: "\e604"; -} -.icon-google:before { - content: "\e609"; -} -.icon-zhihu:before { - content: "\e607"; - font-size: .9em; - position: relative; - top: -2px; -} -.icon-pocket:before { - content: "\e856"; -} - -/* Generic Icon */ -.icon-heart:before { - content: "\e608"; -} -.icon-right:before { - content: "\e60a"; -} -.icon-left:before { - content: "\e60b"; -} -.icon-up:before { - content: "\e60c"; -} -.icon-close:before { - content: "\e60f"; -} diff --git a/src/css/style.scss b/src/css/style.scss index ac08217..50fcf7a 100644 --- a/src/css/style.scss +++ b/src/css/style.scss @@ -5,6 +5,7 @@ @import "_common/animation"; @import "_base"; +@import "_iconfont"; @import "_partial/header"; @import "_partial/post"; @import "_partial/pagination"; @@ -12,7 +13,6 @@ @import "_partial/archive"; @import "_partial/tags"; @import "_partial/categories"; -@import "_partial/iconfont"; @import "_partial/slideout"; @import "_partial/mobile"; @import "_partial/back-to-top"; diff --git a/src/fonts/iconfont/iconfont.eot b/src/fonts/iconfont/iconfont.eot new file mode 100644 index 0000000..912bca3 Binary files /dev/null and b/src/fonts/iconfont/iconfont.eot differ diff --git a/src/fonts/iconfont/iconfont.svg b/src/fonts/iconfont/iconfont.svg new file mode 100644 index 0000000..a13a862 --- /dev/null +++ b/src/fonts/iconfont/iconfont.svg @@ -0,0 +1,93 @@ + + + + + +Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/fonts/iconfont/iconfont.ttf b/src/fonts/iconfont/iconfont.ttf new file mode 100644 index 0000000..f6765c5 Binary files /dev/null and b/src/fonts/iconfont/iconfont.ttf differ diff --git a/src/fonts/iconfont/iconfont.woff b/src/fonts/iconfont/iconfont.woff new file mode 100644 index 0000000..526da66 Binary files /dev/null and b/src/fonts/iconfont/iconfont.woff differ diff --git a/src/webpack.config.js b/src/webpack.config.js index 6dc5c0e..07517b8 100644 --- a/src/webpack.config.js +++ b/src/webpack.config.js @@ -41,7 +41,13 @@ module.exports = { }) }, { - test: /\.(woff|woff2|eot|ttf|otf|svg)$/, + test: /iconfont\.(woff|woff2|eot|ttf|otf|svg)$/, + use: [ + 'file-loader?name=[path][name].[ext]?hash=[hash:7]' + ] + }, + { + test: /apple-chancery-webfont\.(woff|woff2|eot|ttf|otf|svg)$/, use: [ 'file-loader?name=[path][name].[ext]' ] -- cgit v1.2.3