1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Reduce build warnings related to Sass (#10494)

Build warnings related to Sass have been reduced by dynamically
importing `gulp-sass` and `sass-compiler` at the point where it's first
used. This ensures that the four Dart-related build warnings are only
emitted for the build process that is actually running Sass, rather
than by _every_ build process.
This commit is contained in:
Mark Stacey 2021-02-23 13:04:14 -03:30 committed by GitHub
parent 823466b62a
commit 23013b1ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
const pify = require('pify'); const pify = require('pify');
const gulp = require('gulp'); const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer'); const autoprefixer = require('gulp-autoprefixer');
const gulpStylelint = require('gulp-stylelint'); const gulpStylelint = require('gulp-stylelint');
const watch = require('gulp-watch'); const watch = require('gulp-watch');
@ -10,9 +9,7 @@ const rename = require('gulp-rename');
const pump = pify(require('pump')); const pump = pify(require('pump'));
const { createTask } = require('./task'); const { createTask } = require('./task');
// use our own compiler which runs sass in its own process let sass;
// in order to not pollute the intrinsics
sass.compiler = require('./sass-compiler.js');
// scss compilation and autoprefixing tasks // scss compilation and autoprefixing tasks
module.exports = createStyleTasks; module.exports = createStyleTasks;
@ -69,6 +66,14 @@ function createStyleTasks({ livereload }) {
} }
async function buildScssPipeline(src, dest, devMode, rtl) { async function buildScssPipeline(src, dest, devMode, rtl) {
if (!sass) {
// eslint-disable-next-line node/global-require
sass = require('gulp-sass');
// use our own compiler which runs sass in its own process
// in order to not pollute the intrinsics
// eslint-disable-next-line node/global-require
sass.compiler = require('./sass-compiler.js');
}
await pump( await pump(
...[ ...[
// pre-process // pre-process