antd-theme-webpack-plugin icon indicating copy to clipboard operation
antd-theme-webpack-plugin copied to clipboard

Custom variable in specific name convention is not compiled

Open tsiotska opened this issue 3 years ago • 2 comments

If you name variable with dash-number (example: @secondary-1) it will not compile this variable at all, variable will not exist in color.less. If you also try to use '_' it will cause another issue 'cannot read variable @{'1'} of undefined'. However, as workaround i use @secondary1

tsiotska avatar Aug 01 '21 14:08 tsiotska

Yeah been getting the same issue and finally found i'm not loosing my mind. Its the file index.js in the antd-theme-generator line 470-472: themeVars = themeVars.filter( (name) => name in mappings && !name.match(/(.*)-(\d)/) );

I'm sure there's a reason for this. @mzohaibqc could u shed some light here. Commenting the code out runs fine.

shal1y avatar Sep 15 '21 07:09 shal1y

@shal1y such variables are intentionally ignored because ant-design variables are like @red-1, @red-2 ... @red-9. These color variables are color variant of some main color. So differentiating between antd variables and user variables is difficult. If someone want to debug this and come uop with some solution, any PR is welcome.

I am too busy these days so fixing all bugs for me is too difficult so I am requesting community to contribute in this project. I've even started typescript version (branch v2) of this with some tests but could not complete.

mzohaibqc avatar Sep 15 '21 13:09 mzohaibqc