Remove unused promises, opted for forEach iteration

This commit is contained in:
Sean Newell 2017-03-10 09:00:04 -06:00
parent 86d569e636
commit 199b571d07

View File

@ -193,21 +193,17 @@ gulp.task('chat-styles-handlebars', function() {
list.filter(function(path) { list.filter(function(path) {
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory(); return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
}).map(function(dir) { }).forEach(function(dir) {
return new Promise(function(resolve, reject) { gulp.src(config.chatStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars')
gulp.src(config.chatStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars') .pipe(handlebars({
.pipe(handlebars({ // Use specific version of Handlebars.js
// Use specific version of Handlebars.js handlebars: handlebarsEngine
handlebars: handlebarsEngine }))
})) .pipe(wrapHandlebarsTemplate())
.pipe(wrapHandlebarsTemplate()) .pipe(concat('templates.js'))
.pipe(concat('templates.js')) .pipe(uglify({preserveComments: 'some'}))
.pipe(uglify({preserveComments: 'some'})) .pipe(header(config.compiledTemplatesHeader))
.pipe(header(config.compiledTemplatesHeader)) .pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/templates_compiled/client_side'));
.pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/templates_compiled/client_side'))
.on('end', resolve)
.on('error', reject);
});
}); });
}); });
}); });
@ -221,15 +217,11 @@ gulp.task('chat-styles-js', function() {
list.filter(function(path) { list.filter(function(path) {
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory(); return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
}).map(function(dir) { }).forEach(function(dir) {
return new Promise(function(resolve, reject) { gulp.src(config.chatStylesPath + '/' + dir + '/js/source/**/*.js')
gulp.src(config.chatStylesPath + '/' + dir + '/js/source/**/*.js') .pipe(concat('scripts.js'))
.pipe(concat('scripts.js')) .pipe(uglify({preserveComments: 'some'}))
.pipe(uglify({preserveComments: 'some'})) .pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/js/compiled'));
.pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/js/compiled'))
.on('end', resolve)
.on('error', reject);
});
}); });
}); });
}); });
@ -243,21 +235,17 @@ gulp.task('page-styles', function() {
list.filter(function(path) { list.filter(function(path) {
return fs.lstatSync(config.pageStylesPath + "/" + path).isDirectory(); return fs.lstatSync(config.pageStylesPath + "/" + path).isDirectory();
}).map(function(dir) { }).forEach(function(dir) {
return new Promise(function(resolve, reject) { gulp.src(config.pageStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars')
gulp.src(config.pageStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars') .pipe(handlebars({
.pipe(handlebars({ // Use specific version of Handlebars.js
// Use specific version of Handlebars.js handlebars: handlebarsEngine
handlebars: handlebarsEngine }))
})) .pipe(wrapHandlebarsTemplate())
.pipe(wrapHandlebarsTemplate()) .pipe(concat('templates.js'))
.pipe(concat('templates.js')) .pipe(uglify({preserveComments: 'some'}))
.pipe(uglify({preserveComments: 'some'})) .pipe(header(config.compiledTemplatesHeader))
.pipe(header(config.compiledTemplatesHeader)) .pipe(gulp.dest(config.pageStylesPath + '/' + dir + '/templates_compiled/client_side'));
.pipe(gulp.dest(config.pageStylesPath + '/' + dir + '/templates_compiled/client_side'))
.on('end', resolve)
.on('error', reject);
});
}); });
}); });
}); });