Questions tagged [gulp]
Gulp is a JavaScript build system, Node.js-based task runner like Grunt. Gulp uses streams and code-over-configuration for a simpler and more intuitive build process.
gulp
12,679
questions
2075
votes
7
answers
310k
views
NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack [closed]
I'm trying to summarize my knowledge about the most popular JavaScript package managers, bundlers, and task runners. Please correct me if I'm wrong:
npm & bower are package managers. They just ...
898
votes
44
answers
1.1m
views
How to fix "ReferenceError: primordials is not defined" in Node.js
I have installed Node.js modules by 'npm install', and then I tried to do gulp sass-watch in a command prompt. After that, I got the below response.
[18:18:32] Requiring external module babel-register
...
807
votes
72
answers
2.1m
views
Stylesheet not loaded because of MIME type
I'm working on a website that uses Gulp.js to compile and browser sync to keep the browser synchronised with my changes.
The Gulp.js task compiles everything properly, but on the website, I'm unable ...
433
votes
5
answers
540k
views
Node update a specific package
I want to update my Browser-sync without updating all my node packages. How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(
├─┬ [email protected]
│ ├── ...
410
votes
15
answers
257k
views
How to run Gulp tasks sequentially one after the other
in the snippet like this:
gulp.task "coffee", ->
gulp.src("src/server/**/*.coffee")
.pipe(coffee {bare: true}).on("error",gutil.log)
.pipe(gulp.dest "bin")
gulp.task "clean",-...
379
votes
11
answers
158k
views
Is it possible to pass a flag to Gulp to have it run tasks in different ways?
Normally in Gulp tasks look like this:
gulp.task('my-task', function() {
return gulp.src(options.SCSS_SOURCE)
.pipe(sass({style:'nested'}))
.pipe(autoprefixer('last 10 version'))
...
340
votes
21
answers
234k
views
Gulp error: The following tasks did not complete: Did you forget to signal async completion?
I have the following gulpfile.js, which I'm executing via the command line gulp message:
var gulp = require('gulp');
gulp.task('message', function() {
console.log("HTTP Server Started");
});
I'm ...
329
votes
25
answers
506k
views
Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style
When using eslint in the gulp project i have encountered a problem with error like this
Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style and I am using Windows environment for the ...
308
votes
7
answers
154k
views
Why do we need to install gulp globally and locally?
2 manuals about gulp say that I need to install gulp first globally (with -g flag) and then one more time locally. Why do I need this?
277
votes
9
answers
317k
views
After installation of Gulp: “no command 'gulp' found”
After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ ...
269
votes
17
answers
181k
views
Try reinstalling `node-sass` on node 0.12?
I would like to use google web starter kit. I installed node.js v0.12.0, node-sass & gulp.
And then ran:
$ sudo npm install
When I typed gulp serve then got this error:
Using gulpfile ~/web-...
257
votes
41
answers
383k
views
gulp command not found - error after installing gulp
I've installed Gulp both globally and locally using
npm install gulp
npm install gulp -g
npm install gulp-util
npm install gulp-util -g
When try to run gulp I get
'gulp' is not recognized as an ...
251
votes
2
answers
171k
views
Excluding files/directories from Gulp task
I have a Gulp rjs task that concatenates and uglifies all my custom .JS files (any non vendor libraries).
What I am trying to do, is exclude some files/directories from this task (controllers and ...
226
votes
12
answers
158k
views
Pass Parameter to Gulp Task
Normally we can run gulp task from console via something like gulp mytask. Is there anyway that I can pass in parameter to gulp task? If possible, please show example how it can be done.
219
votes
8
answers
75k
views
How to prevent moment.js from loading locales with webpack?
Is there any way you can stop moment.js from loading all the locales (I just need English) when you're using webpack? I'm looking at the source and it seems that if hasModule is defined, which it is ...
197
votes
17
answers
124k
views
Concat scripts in order with Gulp
Say, for example, you are building a project on Backbone or whatever and you need to load scripts in a certain order, e.g. underscore.js needs to be loaded before backbone.js.
How do I get it to ...
190
votes
4
answers
130k
views
How do I copy directories recursively with gulp?
I am trying to stage a project from a working directory to a server (same machine). Using the following code:
gulp.src([
'index.php',
'css/**',
'js/**',
'src/**',
])
.pipe(gulp.dest('/...
185
votes
8
answers
70k
views
Prevent errors from breaking / crashing gulp watch
I'm running gulp 3.6.2 and have the following task that was set up from a sample online
gulp.task('watch', ['default'], function () {
gulp.watch([
'views/**/*.html',
'public/**/*.js'...
183
votes
13
answers
187k
views
Everytime I run gulp anything, I get a assertion error. - Task function must be specified
I'm trying to run the command below but unfortunately I run into errors.
$ gulp build
In my terminal and I get this assertion error. I've uninstalled node and NPM and reinstalled again using brew - ...
182
votes
13
answers
240k
views
Error: ENOENT: no such file or directory, scandir
I scaffold an app using jhipster which is microservice gateway using cassandra db and using maven to build which was building fine after scaffold.i ran gulp command to for the live reload of ui.
i ...
179
votes
12
answers
329k
views
Can't get Gulp to run: cannot find module 'gulp-util'
On Windows 7, I've installed gulp as explained here: http://markgoodyear.com/2014/01/getting-started-with-gulp/:
npm install gulp -g
In my app folder: npm install gulp --save-dev
I create a gulpfile....
175
votes
22
answers
312k
views
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
I have tried to install gulp-sass latest version with npm i gulp-sass --save-dev in the begining I got a lot of errors but later solved them. But whenever I try to run gulp I got this error:
Error: ...
169
votes
7
answers
77k
views
Gulp error: watch task has to be a function
Here is my gulpfile:
// Modules & Plugins
var gulp = require('gulp');
var concat = require('gulp-concat');
var myth = require('gulp-myth');
var uglify = require('gulp-uglify');
var jshint = ...
169
votes
5
answers
73k
views
Gulp + Webpack or JUST Webpack?
I see people using gulp with webpack. But then I read webpack can replace gulp? I'm completely confused here...can someone explain?
UPDATE
in the end I started with gulp. I was new to modern front-...
159
votes
10
answers
157k
views
How to use npm with ASP.NET Core
I'm using npm to manage the jQuery, Bootstrap, Font Awesome and similar client libraries I need for my ASP.NET Core application.
The approach that worked for me started by adding a package.json file ...
154
votes
7
answers
73k
views
Gulps gulp.watch not triggered for new or deleted files?
The following Gulpjs task works fine when editing files in the glob match:
// watch task.
gulp.task('watch', ['build'], function () {
gulp.watch(src + '/js/**/*.js', ['scripts']);
gulp.watch(...
146
votes
7
answers
114k
views
Get the current file name in gulp.src()
In my gulp.js file I'm streaming all HTML files from the examples folder into the build folder.
To create the gulp task is not difficult:
var gulp = require('gulp');
gulp.task('examples', function(...
134
votes
3
answers
32k
views
Gulp.js task, return on src?
I'm new to gulp and have been looking through example set-ups.
Some people have the following structure:
gulp.task("XXXX", function() {
gulp.src("....
Other people have this:
gulp.task("XXXX", ...
128
votes
6
answers
138k
views
Using Gulp to Concatenate and Uglify files
I'm trying to use Gulp to:
Take 3 specific javascript files, concatenate them, then save the result to a file (concat.js)
Take this concatenated file and uglify/minify it, then save the result to ...
125
votes
4
answers
55k
views
What is the ** glob character?
I have this path in my react gulpfile:
var path = {
HTML: 'src/index.html',
ALL: ['src/js/*.js', 'src/js/**/*.js', 'src/index.html'],
JS: ['src/js/*.js', 'src/js/**/*.js'],
MINIFIED_OUT: '...
125
votes
2
answers
23k
views
Task Runners (Gulp, Grunt, etc) and Bundlers (Webpack, Browserify). Why use together?
I am trying to learn about technologies including Grunt, Gulp, Webpack, Browserify, but I did not feel that there is much difference between them.
In other words, I feel Webpack can do everything that ...
119
votes
6
answers
56k
views
Gulp Error: Cannot find module 'jshint/src/cli'
So I've got a fresh install of El Capitan and I'm giving these task runners another go.
I'm following sitepoint's An introduction to Gulp.js, but I'm stuck on step four, when I try to run gulp jshint ...
115
votes
11
answers
139k
views
How to go back 1 folder level with __dirname?
I am using gulp-karma and facing a simple problem but cannot seems to find what i am doing wrong .
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '..\\test\\' +...
115
votes
3
answers
41k
views
How to uglify output with Browserify in Gulp?
I tried to uglify output of Browserify in Gulp, but it doesn't work.
gulpfile.js
var browserify = require('browserify');
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var source =...
115
votes
2
answers
92k
views
gulp globbing- how to watch everything below directory
This is a pretty dumb question, but I haven't really been able to find a satisfactory answer: How do I use gulp globbing to select all files in all subdirectories below a certain directory?
I've ...
109
votes
4
answers
132k
views
Karma: Running a single test file from command line
So, I've been looking all over for this, found "similar" answers here, but not exactly what I want.
Right now if I want to test a single file with karma, I need to do fit(), fdescribe() on the file ...
108
votes
2
answers
47k
views
Multiple file extensions within the same directory using Gulp
So I have a gulpfile.js setup.
In an images folder I have a few images, some are pngs, some jpgs and some gifs.
I want to target all the pngs, jpgs and gifs in the images folder.
I could use **/* ...
108
votes
5
answers
53k
views
Modify file in place (same dest) using Gulp.js and a globbing pattern
I have a gulp task that is attempting to convert .scss files into .css files (using gulp-ruby-sass) and then place the resulting .css file into the same place it found the original file. The problem ...
106
votes
4
answers
45k
views
Javascript: get package.json data in gulpfile.js
Not a gulp-specific question per-se, but how would one get info from the package.json file within the gulpfile.js; For instance, I want to get the homepage or the name and use it in a task.
104
votes
5
answers
34k
views
Task Runner Explorer can't load tasks
I'm using VS2015 and Gulp. I open the Task Runner Explorer and hit refresh, and this shows up in the log:
Failed to run "C:\Projects\Test\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
Error: `...
101
votes
2
answers
83k
views
Use gulp to select and move directories and their files
I'm currently using gulp to call a bash script that cleans my dist/ directory and moves the appropriate files to the clean directory. I would like this to be done with gulp because I am not sure the ...
100
votes
12
answers
131k
views
Gulp command not found after install
I installed gulp(globally) and it looks like it worked because it ran this code:
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├...
100
votes
10
answers
94k
views
gulp.run is deprecated. How do I compose tasks?
Here is a composed task I don't know how to replace it with task dependencies.
...
gulp.task('watch', function () {
var server = function(){
gulp.run('jasmine');
gulp.run('embed');
};
var ...
100
votes
3
answers
115k
views
console.log to stdout on gulp events
I want to log to stdout (the config environment) when a gulp task is running or has run.
Something like this:
gulp.task('scripts', function () {
var enviroment = argv.env || 'development';
var ...
98
votes
8
answers
34k
views
How to get the available tasks list in gulp
Hi Previously I used the grunt in that I want to know the available tasks use grunt --help. But same as in gulp use gulp --help it doesn't show. What is the command to know the available tasks list in ...
97
votes
1
answer
56k
views
Why does gulp.src not like being passed an array of complete paths to files?
I'm attempting to pass gulp.src an array of files that I want it to deal with. This is the array as it stands.
['bower_components/jquery/jquery.js',
'bower_components/superscrollorama/js/greensock/...
95
votes
8
answers
69k
views
UglifyJS throws unexpected token: keyword (const) with node_modules
A small project I started make use a node module (installed via npm) that declares const variables. Running and testing this project is well, but browserify fails when UglifyJS is executed.
...
94
votes
7
answers
140k
views
Local gulp not found (Try running: npm install gulp)
I created a module (webapp-module-storage) which has the following definitions:
package.json
{
"dependencies": {
...
},
"devDependencies": {
"gulp": "^3.9.1",
...
},
"name": "...
93
votes
14
answers
221k
views
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' - Gulp
Consider the following two files:
app.js
import Game from './game/game';
import React from 'react';
import ReactDOM from 'react-dom';
export default (absPath) => {
let gameElement ...
92
votes
5
answers
84k
views
Looking for way to copy files in gulp and rename based on parent directory
For each module I have some files that need to be copied over to the build directory, and am looking for a way to minimize the repeated code from this:
gulp.src('./client/src/modules/signup/index.js'...