Search code examples
gulpdeprecateddart-sass

Gulp and "SASS: Deprecation The legacy JS API" Warning?


As many others, I've recently begun to get this error whenever I compile my SASS.

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

No matter what I do, I can't seem to make this go away, other than using the options silenceDeprecations.

I've tried to simplify my setup to the bare minimum, so here it is:

package.json:

{
    "name": "removed",
    "version": "1.1.1",
    "description": "Removed",
    "author": {
        "name": "Removed",
        "url": "https://www.removed.com"
    },
    "license": "ISC",
    "devDependencies": {
        "gulp": "^4.0.2",
        "gulp-sass": "^5.0.0",
        "sass": "^1.81.0"
    }
}

gulpfile.js

const
    gulp = require('gulp'),
    gulpSass = require('gulp-sass')(require('sass'))
;

const
    theme = {
        css : {
            src     : './assets/sass/app.scss',
            dist    : './dist/css'
        }
    };

const
    sassOptions = {
        errLogToConsole : true,
        outputStyle: 'compressed',
        //silenceDeprecations: ["legacy-js-api"]
    };

/*
    Styling configuration
*/
const themeSass = function() {
    return gulp.src( theme.css.src )
        .pipe( gulpSass( sassOptions ) )
        .pipe( gulp.dest( theme.css.dist ) )
}
themeSass.displayName = 'sass:theme';

exports.sass = gulp.parallel( themeSass );

exports.default = gulp.series( gulp.parallel( themeSass ) );

And finally, my app.scss

body {
    background: red;
}

Solution

  • Seems they've solved this problem as this related issue is closed - https://github.com/dlmanning/gulp-sass/issues/837

    So I've updated the gulp dependencies to their latest versions, and the deprecation warning is gone

    "gulp": "^5.0.0",
    "gulp-sass": "^6.0.0"