failwyn / BundlerMinifier

Visual Studio extension
Other
44 stars 10 forks source link

gulp configuration not working #5

Open baracuda69 opened 2 years ago

baracuda69 commented 2 years ago

Installed product versions

Description

gulpfile.js that is auto created (after choosing "convert to Gulp") does not work due to Gulp having been updated to v4.

Steps to recreate

  1. Right-click on project / website
  2. From Bundler & Minifier context-menu, choose "Convert to Gulp"

Current behavior

Minification does not work and errors are reported in the console (relating to gulp v4 changes).
For example, the following line does not work with gulp 4: gulp.task("min", ["min:js", "min:css", "min:html"]);

Additionally, clean, watch and other methods fail (for the same reasons as above).

instead, it must be rewritten as: gulp.task("min", gulp.series("min:js", "min:css", "min:html"));

Expected behavior

Minification should work (as expected) without any errors (in the console).
I'm attaching a working version of gulpfile.js, which also includes the following changes/modifications, plus sample bundleconfig.json and versionconfig.json files:

Added NPM Packages: "gulp-if" "gulp-uglify-es" [correctly minifies ES6 syntax]

Removed NPM Package: "gulp-uglify" [does NOT minify ES6 syntax and throws errors]

Added version configuration file: versionconfig = require("./versionconfig.json")

version-config adds version-number to the output IF the filename is found within the config-file

Attachmemts:

change_files.zip

baracuda69 commented 2 years ago

In case you're interested in the versioning changes, please find updated and fully-working changes to the gulpfile.js.

In the previous version that I sent, the watch method didn't work as expected, so I changed everything to listen for changes to versionconfig.json.

The new changes ALSO change the versions INSIDE the JS/CSS/HTML files. gulpfile_20220323.zip

If you're interested and want more info / use-cases, please let me know.