Less.js: @variable: none !important; breaks build [3.10.x]

Created on 21 Aug 2019  路  2Comments  路  Source: less/less.js

Works in 3.9.0. Starting with 3.10.0 (tested .1 and .2 as well) the [semantic-ui 2.4.2] build fails:

{ [Error: Cannot create property '_index' on string '!important' in file C:\Scratch\ThrowAwayStuff\bad-semantic\semantic\src\themes\default\collections\table.variables line no. 1] message: 'Cannot create property \'_index\' on string \'!important\' in file C:\\Scratch\\ThrowAwayStuff\\bad-semantic\\semantic\\src\\themes\\default\\collections\\table.variables line no. 1', stack: undefined, type: 'Syntax', filename: 'C:\\Scratch\\ThrowAwayStuff\\bad-semantic\\semantic\\src\\themes\\default\\collections\\table.variables', index: NaN, line: 1, column: -1, callLine: NaN, callExtract: undefined, extract: [ undefined, '/*******************************\r', ' Table\r' ], lineNumber: 1, fileName: 'C:\\Scratch\\ThrowAwayStuff\\bad-semantic\\semantic\\src\\themes\\default\\collections\\table.variables', name: 'Error', plugin: 'gulp-less', showProperties: true, showStack: false, __safety: { toString: [Function: bound ] } }

Removing the single !important from the variable definition makes it work.

bug high priority

Most helpful comment

Testcase:

  • Works with 3.9
  • Breaks with 3.10.x
@responsiveCellBoxShadow: none !important;

.test {
  box-shadow: @responsiveCellBoxShadow;
}

Result

image

All 2 comments

Testcase:

  • Works with 3.9
  • Breaks with 3.10.x
@responsiveCellBoxShadow: none !important;

.test {
  box-shadow: @responsiveCellBoxShadow;
}

Result

image

FWIW I had to revert down to 3.9.x in a project due to what _seems to be_ this same issue, but wasn't able to make a reduced test case at the time. The compiler (using webpack-contrib/less-loader in my case) failed on an !important used on a variable, and after removing the !important, the error moved on to the next !important.

Was this page helpful?
0 / 5 - 0 ratings