Page MenuHomeDevCentral

Legacy JS API is deprecated in Dart Saas
Open, LowPublic

Description

Reference: https://sass-lang.com/documentation/breaking-changes/legacy-js-api/

"Dart Sass originally used an API based on the one used by Node Sass, but replaced it with a new, modern API in Dart Sass 1.45.0. The legacy JS API is now deprecated and will be removed in Dart Sass 2.0.0."

In the static site template we use, Gulp calls this code:

import * as dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);

//…

function compileSass() {

    const postCssPlugins = [
        autoprefixer(),
        PRODUCTION && uncss.postcssPlugin(config.tasks.uncss),
    ].filter(Boolean);

    return gulp.src('src/assets/scss/app.scss')
        .pipe($.sourcemaps.init())
        .pipe(sass({
            includePaths: config.paths.sass
        })
            .on('error', sass.logError))
        .pipe($.postcss(postCssPlugins))
        .pipe($.if(PRODUCTION, $.cleanCss({ compatibility: 'ie9' })))
        .pipe($.if(!PRODUCTION, $.sourcemaps.write()))
        .pipe(gulp.dest(config.paths.dist + '/assets/css'))
        .pipe(browser.reload({ stream: true }));
}

So, sass is invoked through gulp-sass calling their gulpSass() function.

Upstream has a fix since 2022, not merged: https://github.com/dlmanning/gulp-sass/pull/846/files

Event Timeline

dereckson created this task.
dereckson moved this task from Backlog / triage to Gulp / template on the upsection board.
dereckson added a project: Technical debt.
dereckson moved this task from Backlog to Dev on the Technical debt board.