October 26, 2024
Chicago 12, Melborne City, USA
javascript

How to write deprecated legacy JS API code in modern way(custom gulp function)


In advance, thanks for helping

In ‘gulpfile.js’ I have a function:

//Javascript Task
  function jsTask() {
    return src('app/js/script.js')
    //, { sourcemaps: true }
      .pipe(babel({ presets: ['@babel/preset-env'] }))
      .pipe(terser())
      .pipe(dest('dist', { sourcemaps: '.' }));
  }

And it’s used this way:

  // Default Gulp Task
  exports.default = series(scssTask, jsTask, browserSyncServe, watchTask);
  
  // Build Gulp Task
  exports.build = series(scssTask, jsTask);

after I run ‘gulp’ in terminal in VScode I get this message:
**[15:41:06] Starting ‘jsTask’…
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

[15:41:06] Finished ‘jsTask’ after 265 ms**

The project loads in my browser(locallhost) but after saving, changes to the scss files won’t take place in the web page(although the ‘browsersync:connected’ pup up is shown).

It was working just fine till yesterday!!!!!

I checked the link(legacy JS API) out but I got nothing out of it.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video