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

样式引入 #192

Open
briefy opened this issue Dec 12, 2017 · 3 comments
Open

样式引入 #192

briefy opened this issue Dec 12, 2017 · 3 comments

Comments

@briefy
Copy link

briefy commented Dec 12, 2017

这个可以支持更灵活的样式引入吗?
比如现在的ant-design-pro就无法拆分引入

@sorrycc
Copy link
Member

sorrycc commented Dec 12, 2017

如何更灵活才能支持 ant-design-pro 呢?

@draco
Copy link

draco commented Mar 16, 2018

Hello, thanks for the nice work!

I have a question: is this expected to work with ant-design-pro?

I am using this with create-react-app-typescript together with the packages:

    "ant-design-pro": "1.1.0",
    "antd": "3.1.1",
    "babel-plugin-import": "1.6.5",
    "react": "16.2.0",
    "react-app-rewire-typescript": "2.0.2",
    "react-app-rewired": "1.4.1",
    "react-dom": "16.2.0",
    "react-scripts": "1.1.1",
    "react-scripts-ts": "2.8.0",
    "styled-components": "3.1.6",
    "typescript": "2.7.2",
// content of config-overrides (rewire)
const rewireTypescript = require('react-app-rewire-typescript')
const { injectBabelPlugin } = require('react-app-rewired')
const rewireLess = require('react-app-rewire-less')

module.exports = function override(config, env) {
  config = rewireTypescript(config, env)

  config = injectBabelPlugin(
    ['import', { libraryName: 'ant-design-pro', style: true }],
    config
  )

  config = rewireLess.withLoaderOptions({
    modifyVars: theme,
  })(config, env)

  return config
}

Using it like this (similar to advised on https://ant.design/docs/react/use-with-create-react-app)

import { Result } from 'ant-design-pro'

const Home = () => <Result type="success" title="hmm" />

export default Home

But I get Module not found: Can't resolve 'ant-design-pro/lib/result/style' in '/Users/draco/src/manager/src/components/Home'

The differences seem to be

  • the component directory is expected to be lowercase but the actual directory is capitalized (result vs Result)
  • there is no style directory inside each component lib unlike antd

Am I doing something wrong? Thanks in advance!

@yesmeck
Copy link
Contributor

yesmeck commented Mar 16, 2018

这个需要 Ant Design Pro 的支持。

@chenshuai2144

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

No branches or pull requests

4 participants