mrcrowl / vscode-easy-less

Easy LESS extension for Visual Studio Code
MIT License
67 stars 23 forks source link

使用reset参数,编译报错 #56

Closed suwei0708 closed 4 years ago

suwei0708 commented 4 years ago

.rotate(45deg); //编译报错 .rotate(@angle) { .transform-single(rotate, @arguments); } .transform-single(@transform-function, @rest...) { @args: ~"@{rest}".replace(/[\[\]]/g, ""); -webkit-transform: ~"@{transform-function}(@{args})"; -moz-transform: ~"@{transform-function}(@{args})"; -ms-transform: ~"@{transform-function}(@{args})"; transform: ~"@{transform-function}(@{args})"; }

使用easy-less编译报错,koala编译正确。有什么解决办法吗?

mrcrowl commented 4 years ago

Changing .replace(...) to the replace function seems to work:

div {
    .rotate(45deg);
}

.rotate(@Angle) {
    .transform-single(rotate, @arguments);
}

.transform-single(@transform-function, @rest...) {
    @args: replace(~"@{rest}", "[\[\]]", ""); // <====== HERE
    -webkit-transform: ~"@{transform-function}(@{args})";
    -moz-transform: ~"@{transform-function}(@{args})";
    -ms-transform: ~"@{transform-function}(@{args})";
    transform: ~"@{transform-function}(@{args})";
}