Gags
Gags

Reputation: 3829

gulp not creating `concat` file

I am trying to create all.js file from all .js files in one folder with the help of gulp. But i am not getting all.js file.

Steps i have followed as follows:

  1. Created Gulp.js file as below

File: gulpfile.js

// grab our gulp packages
var gulp  = require('gulp'),
    gutil = require('gulp-util'),
    concat = require('gulp-concat-util');

// create a default task and just log a message
gulp.task('default', function() {
  return gutil.log('Gulp is running!')
});

gulp.task('scripts', function() {
  gulp.src(['./js/*.js'])
    .pipe(concat.scripts('all.js'))
    .pipe(uglify())
    .pipe(gulp.dest('./dist/'))
});
  1. run gulp command.

After running gulp, i am getting message as Gulp is running as mentioned in file. But Js file is not created.

Any help shall be appreciated.

Upvotes: 1

Views: 1121

Answers (1)

Adam Jenkins
Adam Jenkins

Reputation: 55613

You're not running the task. You need to run the command gulp scripts

Gulp is a task runner. It allows you to specify tasks. The default task is run when you run the gulp command. If you want to run a task other than the default task you must

  1. Run gulp {{taskname}} where {{taskname}} is callback called via gulp.task in your gulpfile or
  2. Call the specified task via the default task.

You haven't done either. So when you run gulp from the command line, all you are running is the default task, which does nothing except call gutil.log and then return.

Upvotes: 1

Related Questions