ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
192 stars 187 forks source link

Gulp v4: Task function must be specified #405

Open mubasshir opened 4 years ago

mubasshir commented 4 years ago

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 commented 4 years ago

@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 commented 3 years ago

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.