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

Error compiling Angular application implementing Ant design dark theme #5007

Closed
sawa-ko opened this issue Apr 11, 2020 · 2 comments · Fixed by #5012
Closed

Error compiling Angular application implementing Ant design dark theme #5007

sawa-ko opened this issue Apr 11, 2020 · 2 comments · Fixed by #5012
Assignees
Labels
❓ FAQ Frequently asked questions. 🎨 Themes

Comments

@sawa-ko
Copy link

sawa-ko commented Apr 11, 2020

Steps to reproduce

Import the Ant Design styles "ng-zorro-antd/ng-zorro-antd.less"
Import the dark theme styles from "ng-zorro-antd/style/dark.less"

Example (in styles.less file):

// -------- import Ant design less style file -----------
@import '~ng-zorro-antd/ng-zorro-antd.less';
// -------- import Theme dark for Ant design ------------
@import '~ng-zorro-antd/style/dark.less';

What is expected?

Let the Angular app successfully compile and show Ant design with the dark theme.

What is actually happening?

It does not allow to compile the Angular application showing the following error in the console.

ERROR in ./src/styles.less (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/less-loader/dist/cjs.js??ref--14-3!./src/styles.less)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):



.antTreeFn(@tree-prefix-cls);
^
JavaScript evaluation error: 'ReferenceError: colorPalette is not defined'
      in C:\Users\Sawako\Documents\Proyectos\Kodachi\Frontend\client-web\node_modules\ng-zorro-antd\tree\style\index.less (line 217, column 0)
Environment Info
ng-zorro-antd 9.0.0-beta.3
Browser Microsoft Edge V80.0.361.111
@Jbz797
Copy link

Jbz797 commented Apr 11, 2020

Same here.

I fixed it with this at the top of my theme.less :

@import "~ng-zorro-antd/style/color/colorPalette.less";
@import "~ng-zorro-antd/ng-zorro-antd.less";
@import "~ng-zorro-antd/style/dark.less";

@hsuanxyz hsuanxyz self-assigned this Apr 13, 2020
@hsuanxyz
Copy link
Member

@Taksumaki @Jbz797 Thanks for your report.

This is a docs error, the following is the correct import order.

@import "~ng-zorro-antd/style/dark.less";
@import "~ng-zorro-antd/ng-zorro-antd.less";

We are about to provide new theme bundle files, you can use them like this:

@import "~ng-zorro-antd/ng-zorro-antd.dark.less";

hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Apr 13, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Apr 13, 2020
vthinkxie pushed a commit that referenced this issue Apr 13, 2020
@vthinkxie vthinkxie added the ❓ FAQ Frequently asked questions. label Apr 16, 2020
hsuanxyz added a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ FAQ Frequently asked questions. 🎨 Themes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants