Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

SassError: Invalid CSS after "...ch $size in map": expected expression (e.g. 1px, bold), was ".keys(variables.$co" #6431

Closed
fpichlou opened this issue Aug 25, 2020 · 1 comment
Labels

Comments

@fpichlou
Copy link

I'm using RMWC in my React app, It is a react wrapper for material-web-component or MDC. I'm getting the below error when I want to override the --mdc-layout-grid-margin-tablet related variable:

./src/styles/main.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/styles/main.scss)
SassError: Invalid CSS after "...ch $size in map": expected expression (e.g. 1px, bold), was ".keys(variables.$co"
        on line 27 of node_modules/@material/layout-grid/mdc-layout-grid.scss
        from line 4 of /home/myuser/myproject/src/styles/main.scss
>>   @each $size in map.keys(variables.$columns) {

   --------------------^

Also how I can override variable of other material-web-component like this?

@fpichlou fpichlou added the bug label Aug 25, 2020
@asyncLiz
Copy link
Contributor

That error is typically seen when using the node-sass implementation, which does not support Sass modules and is not supported by MDC. You'll need to use the Dart sass implementation.

Luckily it's an easy replacement when using sass-loader. Run npm uninstall node-sass && npm install sass. sass-loader will automatically use the new implementation.

If it does not, check your webpack.config.js in case you're manually specifying the implementation in your sass-loader options. If you are, change implementation: require('node-sass') to implementation: require('sass').

Let us know if you continue to have problems!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants