intoli / antd-scss-theme-plugin

A Webpack plugin for customizing Ant Design with an SCSS theme file and using Ant Design's compiled variables in SCSS files throughout your project.
https://intoli.com/blog/antd-scss-theme-plugin/
Other
202 stars 80 forks source link

scss compile error #31

Closed izvonar closed 6 years ago

izvonar commented 6 years ago

If you use antd variable in theme.scss file without specifying it first, compilation fails with scss error.

theme.scss file

$input-border-color:$primary-color;

Fails because $primary-color is not defined.

I tried it in your example and got the same error.

prncc commented 6 years ago

Hey @izvonar, thanks for reporting. The plugin treats theme.scss as a regular SCSS file, so using theme variables without importing anything won't work. You could instead create a file with the default variables (perhaps by modifying the extractLessVariables method in utils.js) and then import it as needed, or use a second file which imports theme.scss to set values depending on theme variables.