michalkvasnicak / babel-plugin-css-modules-transform

Extract css class names from required css module files, so we can render it on server.
MIT License
326 stars 54 forks source link

when less file has function, the styles props will be {} #67

Closed nikogu closed 6 years ago

nikogu commented 6 years ago

version: 1.2.7

.clearfix(){}

.imgBlock {
    flex: 0 0 62.5%;
    width: 62.5%;
    padding-right: 152px;
    .clearfix();
}

=> babel css modules transform

va style = {};

if remove clearfix will transform ok.

michalkvasnicak commented 6 years ago

@nikogu during the compilation of your less files, there has to be an error occurring which is then digested by babel-plugin-css-modules-transform and uses an empty object as the fallback for this situation.

nikogu commented 6 years ago

But i am sure there is not error occurred, because i use simplest example to test it, the conclusion is that if there has a less function, the style must be {}. 😿

the code like: https://github.com/ant-design/ant-design-pro/commit/debfa5086b7a72f0a370ba82a3e98c67593af02a#diff-84162f6630a352a5f685bc3247617279L3

michalkvasnicak commented 6 years ago

I'm sorry I don't use less at all. This plugin is only wrapper around css-modules-require-hook only thing that can affect processing is what you define in configuration. So maybe less should be configured in different way. Could you provide the configuration for babel-plugin-css-modules-transform you are using in your project?

nikogu commented 6 years ago

ok, i check the code first and find a way, i will push a pr. thanks 😃