question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Less compilation error

See original GitHub issue
ERROR in ./~/css-loader?{"sourceMap":true,"importLoaders":2}!./~/postcss-loader/lib?{"sourceMap":true}!./~/less-loader/dist?{"sourceMap":true,"strictMath":true}!./~/preact-material-components/Button/style.css
Module build failed: 

        .mdc-button.mdc-button--primary::before {
          background-color: color(var(--mdc-theme-primary, #3f51b5) a(12%)); } }
                          ^
Error evaluating function `color`: keyword.toLowerCase is not a function
      in /home/usulix/Development/accountsgui/node_modules/preact-material-components/Button/style.css (line 426, column 28)
 @ ./~/preact-material-components/Button/style.css 4:14-160 18:2-22:4 19:20-166
 @ ./src/lib/FormComponents/LoginButton.js
 @ ./src/components/login/index.js
 @ ./src/components/app.js
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./index.js

Points me to trying to find the correct css processing configuration for webpack Currently I have


use: ExtractTextPlugin.extract({
					fallback: 'style-loader',
					use: [
						{
							loader: 'css-loader',
							options: { sourceMap: CSS_MAPS, importLoaders: 2 }
						},
						{
							loader: `postcss-loader`,
							options: {
								sourceMap: CSS_MAPS,
								plugins: () => {
									autoprefixer({ browsers: [ 'last 2 versions' ] });
								}
							}
						},
						{
							loader: 'less-loader',
							options: { sourceMap: CSS_MAPS, strictMath: true }
						}
					]
				})

and the strictMath: true appears to be required to get through a different portion of the css

ERROR in ./~/css-loader?{"sourceMap":true,"importLoaders":2}!./~/postcss-loader/lib?{"sourceMap":true}!./~/less-loader/dist?{"sourceMap":true}!./~/preact-material-components/LayoutGrid/style.css
Module build failed: 

  padding: 8px;
  padding: calc(var(--mdc-layout-grid-margin, 16px) - var(--mdc-layout-grid-gutter, 16px) / 2); }
^
Operation on an invalid type
      in /home/usulix/Development/accountsgui/node_modules/preact-material-components/LayoutGrid/style.css (line 21, column 2)
 @ ./~/preact-material-components/LayoutGrid/style.css 4:14-160 18:2-22:4 19:20-166
 @ ./src/components/login/index.js
 @ ./src/components/app.js

I was moving along well… until this keyword.toLowerCase error popped up.

and it seems to be the inability of the webpack config I have to get a value from

var(--mdc-theme-primary, #3f51b5) a(12%)

what are you doing to support var() in your css processing, please.

Thanks and best regards

Greg

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
john1jancommented, Sep 11, 2017

I have solved it. After searching a lot got this issue from less repo.

You have to enable strictMath: true in your webpack less loader option.

By default less was not supporting math function in css like calc, scale …etc

{
	loader: 'less-loader',
	options: { strictMath: true}
}
0reactions
prateekbhcommented, Sep 11, 2017

Thanks so much @john1jan u rock 👍 . @usulix lemme know if this still persist for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LESS compile error - css - Stack Overflow
I am using Incident57's CodeKit pre-processor to compile a series of less files that are being imported and minified into a single CSS...
Read more >
Incorrect errors from less compilation · Issue #1170 - GitHub
We have a common less file that gets imported to many different less files, and we get strange errors when building. Such as:...
Read more >
Magento 2 less compilation error while setup:static-content ...
0 I am facing issue in compiling less and css files. The files styles-l.css and styles-m.css are missing - not generated. During static...
Read more >
Command Line Usage - Less CSS
Less extends CSS with dynamic behavior such as variables, mixins, operations and functions. ... Set the method of error reporting when compilation fails....
Read more >
Theme Compilation Issue Due to missing '{' or '}' in Input Less ...
When attempting to compile a theme, an error message similar to the following occurs: Making a change to a single less file in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found