Skip to content
This repository has been archived by the owner on Nov 4, 2018. It is now read-only.

less 方法实现图标本地加载无效 #154

Open
weixiaohuster opened this issue Jul 23, 2017 · 2 comments
Open

less 方法实现图标本地加载无效 #154

weixiaohuster opened this issue Jul 23, 2017 · 2 comments

Comments

@weixiaohuster
Copy link

weixiaohuster commented Jul 23, 2017

按照例子对图标本地化加载,前台请求/font/anticon成功,编译后的css文件anticon字体路径是"/font/iconfont",但是图标在内网情况下仍然显示不出来;同时前台仍然会发送https://at.alicdn.com/t/font_r5u29ls31bgldi.woff请求。
在线求教中……
.babelrc文件
{ "presets": ["es2015", "stage-0", "react"], "plugins": [ "transform-object-assign", ["import", { "libraryName": "antd", }] ] }
custom.less
@import "~antd/dist/antd.less"; @icon-url: "/font/iconfont"; // 把 iconfont 地址改到本地
编译后的ant**.css文件
@font-face { font-family: 'anticon'; src: url('/font/iconfont.eot'); /* IE9*/ src: url('/font/iconfont.eot?#iefix') format('embedded-opentype'), /* chrome、firefox */ url('/font/iconfont.woff') format('woff'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('/font/iconfont.ttf') format('truetype'), /* iOS 4.1- */ url('/font/iconfont.svg#iconfont') format('svg'); }

@weixiaohuster
Copy link
Author

weixiaohuster commented Jul 24, 2017

已解决,主要是因为iconfont库下载的不对。

@ThaddeusJiang
Copy link

@weixiaohuster 有这个原因?谢谢提醒

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants