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

Asked

Viewed 139 times

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 block scripts did not originally exist until when I try to save my scripts to minify them and every time Gulp hangs with this error message ai tried to write the task more now when I remove the comment to run and try to minify the error is different follows below the error.

At Gulp. (/home/rafaelejosi/Area of Job/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 of 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/Area 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) emitat Wo (Vents.js:87:13) At Gaze.Mit (Acts.js:172:7) At Gaze.Emit (/home/rafaelejosi/Area Work/projects/node_modules/gaze/lib/gaze.js:129:32)

1 answer

1


I realized the error in my own code is on a call from the watch

 // 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 solved the problem

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.