Questions tagged [gulp-4]

use this tag for specific issues about Gulp version 4 or upgrading to version 4; use the [gulp] tag for general gulp issues

Gulp version 4

gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow.

Github project: https://github.com/gulpjs/gulp/tree/4.0

Upgrade instructions: https://codeburst.io/switching-to-gulp-4-0-271ae63530c0

Guide to Upgrading to Gulp 4: https://www.joezimjs.com/javascript/complete-guide-upgrading-gulp-4/

115 questions
0
votes
2 answers

How to exit a task with gulp-if

I have a gulp 4 task that processes images. First it minifies them and if a condition is met, SVGs should be turned into PHP partials. How can I implement such a condition and stop the task, if it's not met. function processImages() { return…
David M
  • 99
  • 6
0
votes
1 answer

How to migrate gulp.watch from gulp 3.x to gulp 4.x

I am currently working on migrating gulp from 3.x to 4.x I am struck while converting gulp. Below is the gulp.watch code function isOnlyChange(event) { return event.type === 'changed'; } function watch(){ …
Ragini
  • 13
  • 3
0
votes
1 answer

How to compile and bundle react 16.9 using gulp 4.0.1?

I have an existing project, I used React 16.9. Now, I want to implement Gulp 4.0.1 to build it in the server. I am running in windows 10. In my components, I am using import form I tried using this gulpfile.js, its very simple. var gulp =…
KD.S.T.
  • 573
  • 1
  • 5
  • 27
0
votes
1 answer

Gulp 4 exclude a sass file

Is there a way to exclude a sass file when building? I have the following code: function style() { return gulp .src(['./src/scss/**/*.scss', '!./src/scss/styleguide/**']) .pipe(gulpif(isDevelopment, sourcemaps.init())) .pipe(sassGlob()) …
nmsdvid
  • 2,832
  • 2
  • 21
  • 21
0
votes
1 answer

How load gulp task from file to another task

I have simply 'watchFiles' task which after file changed use task 'reload'. This 'reload' task is in separate file. How can I load this task to my 'watchFiles' task when I don't want this task in the same file? // watchFiles…
0
votes
0 answers

How to get Gulp v4 watch observe file changes?

Here is a very minimalistic example gulpfile.js: var gulp = require('gulp'); function foo(done) { console.log('change'); done(); } function watchFiles() { console.log('starting watching...'); gulp.watch('./gulpfile.js',…
automatix
  • 14,018
  • 26
  • 105
  • 230
0
votes
1 answer

How do I combine multiple CommonJS modules in a single JS file with Gulp.js?

I've used Gulp.js for a variety of different implementations, some of them were only about plain and simple minification of a single JavaScript source file, some of them were minification and copying of multiple files, while others were around using…
myTerminal
  • 1,596
  • 1
  • 14
  • 31
0
votes
1 answer

gulp 4 - use watch for server job instead of compiler job

If you have a task that starts and finishes, that needs to be run every time files change, that well documented here https://gulpjs.com/docs/en/getting-started/watching-files const { watch } = require('gulp'); exports.default = function() { //…
Alex028502
  • 3,486
  • 2
  • 23
  • 50
0
votes
1 answer

Gulp Watch performs all tasks again instead of just those that were changed

I have problems with Gulp Watch when it only has to process the files that have been modified When I start, Gulp performs the tasks correctly, but when I make a change Gulp watch performs all the tasks again instead of just those that were changed.…
Aarón Más
  • 71
  • 1
  • 1
  • 7
0
votes
1 answer

Why is this gulp script behaving differently between v4.0.0-alpha.2 and v4.0.2?

Whilst this script is using gulp 4.0.0-alpha.2, I suspect that the script was originally written for 3.x. I have a gulp script that I inherited which has the following task present: pump([ gulp.src(['app\\images\\**\\*.*']), …
Rob
  • 45,296
  • 24
  • 122
  • 150
0
votes
1 answer

Gulp 4 - How to generate dynamic tasks based on two arrays

I'm building an e-mail generation pipeline (multiple templates) using nunjucks and json translation files. This means I need to loop over the multiple templates and the translation files, however I can't seem to get it working. Tried adding another…
elDrimm
  • 106
  • 1
  • 9
0
votes
1 answer

Gulp task for Sass doesn't create CSS file

I am a beginner and have completed my HTML & CSS. For Sass, I am trying to set-up a dev environment and for some reason the gulpfile.js code appears to be OK, but when the task is run (gulp style) then it doesn't output a CSS file. There are no…
Karthik
  • 1
  • 1
0
votes
1 answer

Gulp 4 dev and production method

I've recently decided to update some really old gulp files to gulp 4. I pretty much started from scratch as my workflow is totally different and therefore I wanted a bespoke solution to fit how I now work. So far I have a file that will process my…
Gerico
  • 5,079
  • 14
  • 44
  • 85
0
votes
1 answer

Re-wrote gulpfile.js for Gulp 4 and default task hangs now

I upgraded from Gulp 3.9.1 to Gulp. 4.0.1 and now when I run it I see "Starting 'default'..." and nothing else happens. Here's the end of my gulpfile: gulp.task('default', function() { gulp.watch('app/styles/**/*.scss', gulp.series('sass')), …
4sight
  • 31
  • 10
0
votes
1 answer

gulp 4 not updating CSS and JS

I am developing my own themes for WordPress, I came to know about Glup and how easy it made my workflow, the problem I am facing with my below code is I am able to see the immediate changes I am making to the main page (html or php) but any changes…
Moosa
  • 163
  • 2
  • 13