src-zone/material

Postcss warning

Closed this issue · 4 comments

Hello,

When compiling my angular project, i keep receiving those warnings:

./src/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--15-3!./src/styles.scss)
Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning

(6914:3) start value has mixed support, consider using flex-start instead

I think that they are mainly related to the imported sass styles inside my styles.scss file

@import "material-components-web/material-components-web";

Is there anyway to override the align-items: start; property which causing this or to disable those warnings?

Thanks.

Yes they are part of the upstream material-components-web styles. You can safely ignore those warnings. We have not found a way to disable those specific warnings. They will probably be gone once we update to the latest material-components-web. We expect that update to be released in a couple of weeks.

Okay thanks, as a temporary workaround i've create a postinstall.js file as below:

let fs = require('fs');

function changeFile(file, currLine, newLine) {
  if (!fs.existsSync(file)) return;
  let data = fs.readFileSync(file, 'utf8');
  let result = data.replace(currLine, newLine);

  fs.writeFile(file, result, err => {
    if (err) console.log(err);
  });
}

// Fix postcss compile warnings
let files = [
  './node_modules/@material/toolbar/mdc-toolbar.scss',
  './node_modules/@material/toolbar/_mixins.scss'
];
let searchFileForString = 'align-items: start;';
let replaceFileWithString = 'align-items: flex-start;';

for (let file of files) {
  changeFile(file, searchFileForString, replaceFileWithString);
}

Then added a shortcut to run the script in my package.json:

"scripts": {
+  "postinstall": "node ./postinstall.js",
   ...
}

& Finally executed the script using npm run postinstall (to be executed after each npm install).

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still relevant, please leave a comment (for example, "bump"), and we'll keep it open. Thank you for your contributions.

stale commented

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for it to be reopened. Thank you!