dlmanning / gulp-sass

SASS plugin for gulp
MIT License
1.57k stars 381 forks source link

hide Deprecation Warnings #871

Closed marsaultgaetan closed 2 days ago

marsaultgaetan commented 1 week ago

Hi, I'm using gulp-sass ^5.1.0, and I've lots of warning messages during compilations.

Warnings are about The legacy JS API, @import rules, map-get rules, ...

If I understand, I've 2 solutions :

For the moment, I'ld like to hide Deprecation Warnings, but I can't do it.

With this gulpfile code, Deprecation Warnings always appear :

function css() {
  return src(dir_src + "scss/*.scss")
    .pipe(sass({ 
      includePaths: [dir_nodeModules],
      quiet: true, 
      quietDeps: true 
  }).on('error', sass.logError))
    .pipe(dest(dir_assets + "css/"));
}

Can you help me ? Thanks !

beatrizsmerino commented 4 days ago

I've updated every part of the outdated code but I kept seeing this message:

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
More info: https://sass-lang.com/d/legacy-js-api

I have found a solution here: https://stackoverflow.com/a/79180897/10855837

You can add a silenceDeprecations option to temporarily hide these warnings:

const gulp = require("gulp");
const sass = require("gulp-sass")(require("sass"));

gulp.task("sass", function(){
  return gulp
    .src("./src/sass/*.scss")
    .pipe(sass({
      silenceDeprecations: ['legacy-js-api'],
    }))
    .pipe(gulp.dest("./dist/css"));
});
xzyfer commented 2 days ago

@beatrizsmerino is correct. Additionally we've released v6.0.0 which should resolve the The legacy JS API is deprecated warning.

marsaultgaetan commented 2 days ago

@beatrizsmerino when you say "I've updated every part of the outdated", you've done this for example :

I think it weighs down Sass's writing, don't you? Thanks for your answer !

beatrizsmerino commented 2 days ago

@beatrizsmerino when you say "I've updated every part of the outdated", you've done this for example :

  • change @import to @use ?
  • change font-family: $font-primary; to font-family:variables.$font-primary; ?
  • change $container: pxtoem(700px); to $container: mixins.pxtoem(700px); ?
  • ...

I think it weighs down Sass's writing, don't you? Thanks for your answer !

Exactly as you say @marsaultgaetan, before disabling the warning I have corrected some parts of the code like:

Captura de pantalla 2024-11-27 a las 18 47 59 Captura de pantalla 2024-11-27 a las 18 47 27 Captura de pantalla 2024-11-27 a las 18 48 27 Captura de pantalla 2024-11-27 a las 18 48 47

https://github.com/beatrizsmerino/vue-editor https://github.com/beatrizsmerino/validation-form