Main task is provided to user availability to put login and password before each run task. So i try to use promises, but in such case my sequence doesn`t start because task finished when promise resolved.
export default function() {
var loginPromise = new Promise((resolve, reject) => {
inquirer.prompt(config.loginQuestions).then(answer => {
if (!(answer.login.length && answer.password.length)) {
reject('loginError')
} else {
resolve(answer)
}
});
});
return loginPromise;
};
And task
import login from '../util/login';
gulp.task('sassComponents', function() {
return login().then(function(answer) {
console.log('started') //This code executed and i see console
return gulp.src(conf.sassPath)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(autoprefixer(config.autoprefixer))
.pipe(sourcemaps.write())
.pipe(gulp.dest(function(file) {
return destPath(file) // destPath doesn`t start
}))
})
});
So login() is execution of first function. Then console appear but destPath doesn`t start. Maybe you have any idea how to fix it?