Ng-zorro-antd: 引入ng-zorro-antd后,全局样式冲突。

Created on 20 Sep 2017  ·  14Comments  ·  Source: NG-ZORRO/ng-zorro-antd

I'm submitting a...


[ ] Bug report  
[*] Feature request
[ ] Documentation issue or request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Support request => Please do not submit support request here

Current behavior

引入ng-zorro-antd后全局样式冲突

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgZorroAntdModule } from 'ng-zorro-antd';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgZorroAntdModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Expected behavior


样式全部加载到style标签里面。无法提取到css里面,无法重写覆盖样式

Environment


Angular version: 4.2.4

ng-zorro-antd version: 0.5.1

Browser:
- [ *] Chrome (desktop) version new
- [ *] Firefox version new
- [ *] Safari (desktop) version new
- [ *] IE version new

For Tooling issues:
- Node version:6.10.2  
- Platform:  

Others:

Most helpful comment

不支持样式定制就无法满足产品的UI需求 @vthinkxie

All 14 comments

wx20170920-180109 2x
This is my desperation solution.In special cases, if an attribute is not defined in the ng-zorro-antd, then '!improtant' is not necessary.If you have a better solution,please tell me🤦🏻‍♂️

duplicated #202 , you can just overwrite all style over your css file.

@zy-dreamer @vthinkxie 请注意,zorro的样式再webpack下会放到页面的style标签下,我重写的样式再css下面。优先级导致我覆盖不到。有什么方法可以将zorro的样式提取出来嘛?

@wjtGitHub
All ant styles are css in js, the style will only work when you import zorro module, and css file can not import separated with current design.

在生产环境下,必须把css抽离于js,但是,antd的样式始终在style标签下,导致我重写的样式无法覆盖antd的样式。何解?@vthinkxie

@wjtGitHub you can overwrite all style like @zy-dreamer .

像下图的样式,我无论如何也重写不掉
image
因为我重写得样式再css里面,而antd的在style里面
@vthinkxie

@wjtGitHub use important

@vthinkxie 我不认为这是一个好的办法,我觉得zorro应该改进这部分。非常感谢你的解答,我心里已经有谱了。

@wjtGitHub just a trade-off, it is impossible to support both style lazy load and style customization.

@zy-dreamer 谢谢

不支持样式定制就无法满足产品的UI需求 @vthinkxie

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

s01c83l picture s01c83l  ·  3Comments

vthinkxie picture vthinkxie  ·  3Comments

ismezy picture ismezy  ·  3Comments

rahulmistry25425 picture rahulmistry25425  ·  3Comments

linjianhong picture linjianhong  ·  3Comments