how to solve the problem Task 'scripts' is not in your gulpfile

1

This is my gulpfile:

var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var babel = require('gulp-babel');
var minify = require('gulp-minify');

// task para o sass
gulp.task('sass', function() {
    return gulp.src('sass/**/*.sass')
        .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
        .pipe(gulp.dest('css'));
});

// tasks para JavaScript
// task para babel
gulp.task('babel', () =>
    gulp.src('scripts/**/*.js')
        .pipe(babel({
            presets: ['env']
        }))
        .pipe(gulp.dest('js'))
);
// task minify
gulp.task('compress', function() {
  gulp.src('scripts/**/*.js')
    .pipe(minify({
        ext:{
            src:'.js',
            min:'-min.js'
        },
        exclude: ['tasks'],
        ignoreFiles: ['.combo.js', '-min.js']
    }))
    .pipe(gulp.dest('js'))
});

// scripts
// gulp.task('scripts',function(){
//     return('/scripts/**/*js')
//     .pipe(babel('babel'))
//     .pipe(minify('compress'))
// });

// task para watch
gulp.task('watch', function(){
    gulp.watch('sass/**/*.sass', ['sass']);
    gulp.watch('scripts/**/*.js', ['scripts']);
});
// task default gulp
gulp.task('default', ['sass', 'watch', 'babel', 'compress']);

The script block did not originally exist until when I try to save my scripts to minify them and every time the gulp hangs with this error message I tried to write the task more now when I remove the comment to execute and try to minify the error is different below the error.

  

At Gulp. (/ home / rafaelejosi / Area of   Work / projects / gulpfile.js: 40: 6)   at module.exports (/ home / rafaelejosi / Area of   Work / Projects / node_modules / orchestrator / lib / runTask.js: 34: 7)   at Gulp.Orchestrator._runTask (/ home / rafaelejosi / Area   Work / Projects / node_modules / orchestrator / index.js: 273: 3)   at Gulp.Orchestrator._runStep (/ home / rafaelejosi / Area of   Work / Projects / node_modules / orchestrator / index.js: 214: 10)   at Gulp.Orchestrator.start (/ home / rafaelejosi /   Work / projects / node_modules / orchestrator / index.js: 134: 8)   at Gulp. (/ home / rafaelejosi / Area of   Work / Projects / node_modules / gulp / index.js: 36: 18)   at Gaze. (/ home / rafaelejosi / Area of   Work / Projects / node_modules / glob-watcher / index.js: 18: 14)   at emitTwo (events.js: 87: 13)   at Gaze.emit (events.js: 172: 7)   at Gaze.emit (/ home / rafaelejosi / Area of   Work / Projects / node_modules / gaze / lib / gaze.js: 129: 32)

    
asked by anonymous 09.09.2017 / 12:56

1 answer

1

I noticed the error in my own code is in a watch call

 // task para watch gulp.task('watch', function(){ gulp.watch('sass//.sass', ['sass']); gulp.watch('scripts//.js', ['scripts']); });

I changed the word scripts by babel which is another task of my code and I solved the problem

 // task para watch gulp.task('watch', function(){ gulp.watch('sass//.sass', ['sass']); gulp.watch('scripts//.js', ['babel']); });
    
09.09.2017 / 13:11