Task function must be specified at Gulp.set

hello
I am trying to concatenate CSS Files; I am facing this problem when I am using this script
(Please note that I have installed gulp and gulp-concat)
This is my script

var gulp = require('gulp');
var concat = require('gulp-concat');

gulp.task('default', function() {
});

gulp.task('css', function() {
    return gulp.src('css/*.css')
        .pipe(concat('concat.css'))
        .pipe(gulp.dest('css/dist'));
});

gulp.task('default', ['css']);

This is the error output

$ node filemerger.js
assert.js:42
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (C:\optimisation\linksandscripts\cssmerging2\node_
modules\undertaker\lib\set-task.js:10:3)
    at Gulp.task (C:\optimisation\linksandscripts\cssmerging2\node_modules\under
taker\lib\task.js:13:8)
    at Object.<anonymous> (C:\optimisation\linksandscripts\cssmerging2\filemerge
r.js:13:6)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)

Thanks in advance

says that task is not recommended and that you should be exporting instead.

That said.

It also seems like your last line is the culprit - gulp.task('default', ['css']); does not match a parameter set of that function. task() takes either (string, function) or (function), not (string, array).

1 Like

@m_hutley which function do you mean? How can I replace this line I mean
Thanks in advance

You have no function defined on your last task. I think @m_hutley is right…

gulp.task('default', ['css'], function() {
 // empty function
});

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.