Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp configuration not working #5

Open
baracuda69 opened this issue Mar 16, 2022 · 1 comment
Open

gulp configuration not working #5

baracuda69 opened this issue Mar 16, 2022 · 1 comment

Comments

@baracuda69
Copy link

Installed product versions

  • Visual Studio: 2022 Community
  • This extension: 2.9.3

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant