less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Error when using css variables without semi.

Open honkinglin opened this issue 7 years ago • 3 comments

Hey,I found it will parse error when I import a css like this: import './test.css'

// test.css
.test {
    --animate-margin-top: -30px;
    --animate-transform-vertical: top
}

the error detail is:

ERROR in ./src/test.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/less-loader/dist/cjs.js):
    --animate-transform-vertical: top
}

Unrecognised input. Possibly missing opening '{'
......

I know it's not a good idea to leave CSS without a semicolon at the end,but it is normal in the [email protected] version,so it kind of confused me.

honkinglin avatar Mar 12 '19 09:03 honkinglin

Confirmed.

seven-phases-max avatar Mar 22 '19 21:03 seven-phases-max

This likely won't be addressed until Less 4.

matthew-dean avatar Jul 16 '20 18:07 matthew-dean

Still not good?

raind33 avatar Mar 03 '22 11:03 raind33

Hello,

The issue is still happening in version [email protected].

As @HQ-Lin commented, it happens when you have a variable without semi colon at the end of the block.

This can be fixed by adding the semi colon if you are the owner of the code, but in case of a third-party library it is not viable.

I am using lessc file.less --clean-css="--s1 --advanced" to minify some files that later are used in other projects.

moelders avatar Oct 19 '22 11:10 moelders