Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Gulp v4: Task function must be specified #405

Open
mubasshir opened this issue Aug 29, 2019 · 2 comments
Open

Gulp v4: Task function must be specified #405

mubasshir opened this issue Aug 29, 2019 · 2 comments

Comments

@mubasshir
Copy link

mubasshir commented Aug 29, 2019

I'm facing gulp 4 issue Task function must be specified

Node version: 12.9.1
NPM: 6.10.3
(unfortunately, I cannot degrade node)

My gulpfile.js

var gulp = require('gulp');
var sass = require('gulp-sass');
var cleanCss = require('gulp-clean-css');
var rename = require('gulp-rename');

var paths = {
  sass: ['./scss/**/*.scss']
};

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

gulp.task('sass', function(done) {
  gulp.src('./scss/ionic.app.scss')
    .pipe(sass())
    .on('error', sass.logError)
    .pipe(gulp.dest('./www/css/'))
    .pipe(cleanCss({
      keepSpecialComments: 0
    }))
    .pipe(rename({ extname: '.min.css' }))
    .pipe(gulp.dest('./www/css/'))
    .on('end', done);
});

gulp.task('watch', ['sass'], function() {
  gulp.watch(paths.sass, ['sass']);
});

my package.json

        ...
        "gulp": "^4.0.2",
        "gulp-clean-css": "^4.2.0",
        "gulp-rename": "^1.4.0",
        "gulp-sass": "^4.0.2",
        ...

Does anyone has updated gulp.js for ionic 1 & node 12+ ?
(Meanwhile, I'm looking into the migration of gulpfile.js to v4 syntax)

@iampavanarora
Copy link

@mubasshir I think you need to set watch task like this
var paths = {
sass: ['./scss/**/*.scss']
};

gulp.task('sass', function () {
return gulp.src(['./scss/ionic.app.scss'])
.pipe(sass())
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
});

gulp.task('watch', function() {
gulp.watch(paths.sass, gulp.series('sass'));
});

if this not work downgrade your packages
"gulp": "^4.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^3.1.0"

@rolinger
Copy link

I gave up on upgrading to gulp 4 and just stuck with node@10. But this issue is now going to force me to finally port my app to Ionic 4/5. Its long over due but at the same time its going to be very painful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants