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

fix icon in package theme #2

Merged
merged 1 commit into from
Nov 23, 2016
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
5 changes: 1 addition & 4 deletions theme.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@

module.exports = () => {

return {
'@primary-color': '#1DA57A',
'@link-color': '#1DA57A',
'@border-radius-base': '2px',
'@icon-url': '/assets/fonts/iconfont/iconfont'
'@icon-url': '"/assets/fonts/iconfont/iconfont"',
Copy link
Contributor Author

@afc163 afc163 Nov 22, 2016

Choose a reason for hiding this comment

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

What makes u fail is missing the ".

Choose a reason for hiding this comment

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

{test: /.woff(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=100000&minetype=application/font-woff'},
{test: /.woff2(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=100000&minetype=application/font-woff'},
{test: /.ttf(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=100000&minetype=application/octet-stream'},
{test: /.eot(?v=\d+.\d+.\d+)?$/, loader: 'file'},
{test: /.svg(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=100000&minetype=image/svg+xml'},

cannot work!!!!!

Choose a reason for hiding this comment

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

使用相对路径会报错,绝对路径会导致webpack没有将字体打包~

Choose a reason for hiding this comment

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

@chenxiaojie 后面有解决吗

Choose a reason for hiding this comment

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

@chenxiaojie 今天花了两个小时研究,发现同样的问题,真是无语,建议antd团队将字体文件随包发布,而需要CDN引用的再定义modifyVars

Choose a reason for hiding this comment

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

@phantom0424 没有解决,不优雅的解决了。
将字体和图片放在本项目里面,自己再写一份覆盖。

Copy link

Choose a reason for hiding this comment

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

这个双引号问题确实折腾半天,后来恍然大悟

};

};
19 changes: 15 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,33 @@ module.exports = function (webpackConfig, env) {
webpackConfig.babel.plugins.push('transform-runtime');
webpackConfig.babel.plugins.push(['import', {
libraryName: 'antd',
style: 'css' // if true, use less
style: true,
}]);

// Enable hmr for development.
if (env === 'development') {
webpackConfig.babel.plugins.push('dva-hmr');
}


// CSS Modules Support.
// Parse all less files as css module.
webpackConfig.module.loaders.forEach(function (loader, index) {
webpackConfig.module.loaders.forEach(function(loader, index) {
if (typeof loader.test === 'function' && loader.test.toString().indexOf('\\.less$') > -1) {
loader.test = /\.dont\.exist\.file/;
loader.include = /node_modules/;
loader.test = /\.less$/;
}
if (loader.test.toString() === '/\\.module\\.less$/') {
loader.exclude = /node_modules/;
loader.test = /\.less$/;
}
if (typeof loader.test === 'function' && loader.test.toString().indexOf('\\.css$') > -1) {
loader.include = /node_modules/;
loader.test = /\.css$/;
}
if (loader.test.toString() === '/\\.module\\.css$/') {
loader.exclude = /node_modules/;
loader.test = /\.css$/;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

});

return webpackConfig;
Expand Down