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

无法修改全局样式 #575

Closed
grunmin opened this issue Feb 9, 2017 · 4 comments
Closed

无法修改全局样式 #575

grunmin opened this issue Feb 9, 2017 · 4 comments
Labels

Comments

@grunmin
Copy link

grunmin commented Feb 9, 2017

根据定制主题里面的描述, 我用package.theme的方式试图修改全局主题样式, 但是发现无效

配置如下:

.roadhogrc

{
  "entry": "src/index.js",
  "disableCSSModules": false,
  "autoprefixer": null,
  "proxy": null,
  "extraBabelPlugins": [
    "transform-runtime",
    ["import", { "libraryName": "antd", "style": true }]
  ],
  "env": {
    "development": {
      "extraBabelPlugins": [
        "dva-hmr"
      ]
    }
  }
}

package.json

{
  "private": true,
  "scripts": {
    "start": "roadhog server --no-open",
    "build": "roadhog build",
    "lint": "eslint --ext .js src test",
    "precommit": "npm run lint"
  },
  "dependencies": {
    //略
  },
  "devDependencies": {
    //略
  },
  "theme": "./src/theme.js"
}

src/theme.js

module.exports = () => {
  return {
    '@border-radius-base': '3px',
    '@border-radius-sm': '2px',
    '@shadow-color': 'rgba(0,0,0,0.05)',
    '@shadow-1-down': '4px 4px 40px @shadow-color',
    '@border-color-split': '#f4f4f4',
    '@border-color-base': '#e5e5e5',
    '@menu-dark-bg': '#3e3e3e',
    '@text-color': '#666',
    '@font-size-base': '14px',
    '@font-family': 'monospace,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif'
  }
}

theme.js文件的变量是参考了项目ant-admin, 我换成官网的也不行, 官网的是

module.exports = () => {
  return {
    'primary-color': '#1DA57A',
    'link-color': '#1DA57A',
    'border-radius-base': '2px',
    'text-color': 'fade(#000, 90%)',
    'font-size-base': '13px'
  };
};

主要是将字体颜色调深. 但是发现没有效果.

请教大佬可能问题会出在哪儿呢

afc163 added a commit to ant-design/ant-design that referenced this issue Feb 9, 2017
@afc163
Copy link
Contributor

afc163 commented Feb 9, 2017

更新了一下文档:#562

@grunmin
Copy link
Author

grunmin commented Feb 9, 2017

@afc163
好的, 我试试

@afc163
Copy link
Contributor

afc163 commented Feb 9, 2017

ant-design/ant-design@10199e5

@grunmin
Copy link
Author

grunmin commented Feb 9, 2017

可以了, 谢谢大佬 @afc163

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

No branches or pull requests

3 participants