Skip to content

Instantly share code, notes, and snippets.

@ptflp
Last active June 20, 2018 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptflp/f86694ea2320f792af48e691e2e5f1ff to your computer and use it in GitHub Desktop.
Save ptflp/f86694ea2320f792af48e691e2e5f1ff to your computer and use it in GitHub Desktop.
Gulp 4 installation
var
gulp = require("gulp"),
browserSync = require('browser-sync').create(),
childProcess = require('child_process');
gulp.task('docker-start', function (callback) {
console.log("---------Start--------------------------");
return childProcess.exec('Powershell.exe -executionpolicy remotesigned -File docker.ps1', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
if (err) console.log(err);
console.log("Finished");
});
});
gulp.task('watch', function () {
gulp.watch("./**/*.php").on('change', gulp.parallel(browserSync.reload));
});
gulp.task('ws', function() {
browserSync.init({
proxy: "localhost:8000",
notify: false,
snippetOptions: {
rule: {
match: /$/
}
}
});
});
gulp.task('init', gulp.series('docker-start','ws'));
gulp.task("default",gulp.parallel('watch','init'));
# Uninstall previous Gulp installation and related packages, if any
$ npm rm gulp -g
$ npm rm gulp-cli -g
$ cd [your-project-dir/]
$ npm rm gulp --save-dev
$ npm rm gulp --save
$ npm rm gulp --save-optional
$ npm cache clean
# Install the latest Gulp CLI tools globally
$ npm install gulpjs/gulp-cli -g
# Install Gulp 4 into your project from 4.0 GitHub branch as dev dependency
$ npm install gulpjs/gulp#4.0 --save-dev
# Check the versions installed. Make sure your versions are not lower than shown.
$ gulp -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment