mirror of
https://github.com/Mibew/mibew.git
synced 2025-06-04 16:16:15 +03:00
Made changes to conform to code review comments.
This commit is contained in:
parent
7c822661e6
commit
86d569e636
122
src/gulpfile.js
122
src/gulpfile.js
@ -186,78 +186,84 @@ gulp.task('chat-styles', ['chat-styles-handlebars', 'chat-styles-js'], function(
|
|||||||
|
|
||||||
// Compile and concatenate handlebars files for all chat styles.
|
// Compile and concatenate handlebars files for all chat styles.
|
||||||
gulp.task('chat-styles-handlebars', function() {
|
gulp.task('chat-styles-handlebars', function() {
|
||||||
var promises = [];
|
fs.readdir(config.chatStylesPath, function(err, list) {
|
||||||
fs.readdir(config.chatStylesPath, function(err, list){
|
if(err) {
|
||||||
if(err) return done(err);
|
throw err;
|
||||||
list.filter(function(path){
|
}
|
||||||
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
|
|
||||||
}).map(function(dir){
|
|
||||||
promises.push(new Promise(function(resolve, reject){
|
|
||||||
var pipeline = gulp.src(config.chatStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars')
|
|
||||||
.pipe(handlebars({
|
|
||||||
// Use specific version of Handlebars.js
|
|
||||||
handlebars: handlebarsEngine
|
|
||||||
}))
|
|
||||||
.pipe(wrapHandlebarsTemplate())
|
|
||||||
.pipe(concat('templates.js'))
|
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
|
||||||
.pipe(header(config.compiledTemplatesHeader))
|
|
||||||
.pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/templates_compiled/client_side'));
|
|
||||||
pipeline.on('end', resolve);
|
|
||||||
pipeline.on('error', reject);
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Compile and concatenate js files for all chat styles.
|
list.filter(function(path) {
|
||||||
gulp.task('chat-styles-js', function() {
|
|
||||||
var promises = [];
|
|
||||||
fs.readdir(config.chatStylesPath, function(err, list){
|
|
||||||
if(err) return done(err);
|
|
||||||
list.filter(function(path){
|
|
||||||
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
|
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
|
||||||
}).map(function(dir){
|
}).map(function(dir) {
|
||||||
promises.push(new Promise(function(resolve, reject){
|
return new Promise(function(resolve, reject) {
|
||||||
var pipeline = gulp.src(config.chatStylesPath + '/' + dir + '/js/source/**/*.js')
|
gulp.src(config.chatStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars')
|
||||||
.pipe(concat('scripts.js'))
|
|
||||||
.pipe(uglify({preserveComments: 'some'}))
|
|
||||||
.pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/js/compiled'));
|
|
||||||
pipeline.on('end', resolve);
|
|
||||||
pipeline.on('error', reject);
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Performs all job related with pages styles.
|
|
||||||
gulp.task('page-styles', function() {
|
|
||||||
var promises = [];
|
|
||||||
fs.readdir(config.pageStylesPath, function(err, list){
|
|
||||||
if(err) return done(err);
|
|
||||||
list.filter(function(path){
|
|
||||||
return fs.lstatSync(config.pageStylesPath + "/" + path).isDirectory();
|
|
||||||
}).map(function(dir){
|
|
||||||
promises.push(new Promise(function(resolve, reject){
|
|
||||||
var pipeline = 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.chatStylesPath + '/' + dir + '/templates_compiled/client_side'))
|
||||||
pipeline.on('end', resolve);
|
.on('end', resolve)
|
||||||
pipeline.on('error', reject);
|
.on('error', reject);
|
||||||
}));
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Compile and concatenate js files for all chat styles.
|
||||||
|
gulp.task('chat-styles-js', function() {
|
||||||
|
fs.readdir(config.chatStylesPath, function(err, list) {
|
||||||
|
if(err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.filter(function(path) {
|
||||||
|
return fs.lstatSync(config.chatStylesPath + "/" + path).isDirectory();
|
||||||
|
}).map(function(dir) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
gulp.src(config.chatStylesPath + '/' + dir + '/js/source/**/*.js')
|
||||||
|
.pipe(concat('scripts.js'))
|
||||||
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
|
.pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/js/compiled'))
|
||||||
|
.on('end', resolve)
|
||||||
|
.on('error', reject);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Performs all job related with pages styles.
|
||||||
|
gulp.task('page-styles', function() {
|
||||||
|
fs.readdir(config.pageStylesPath, function(err, list) {
|
||||||
|
if(err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.filter(function(path) {
|
||||||
|
return fs.lstatSync(config.pageStylesPath + "/" + path).isDirectory();
|
||||||
|
}).map(function(dir) {
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
gulp.src(config.pageStylesPath + '/' + dir + '/templates_src/client_side/**/*.handlebars')
|
||||||
|
.pipe(handlebars({
|
||||||
|
// Use specific version of Handlebars.js
|
||||||
|
handlebars: handlebarsEngine
|
||||||
|
}))
|
||||||
|
.pipe(wrapHandlebarsTemplate())
|
||||||
|
.pipe(concat('templates.js'))
|
||||||
|
.pipe(uglify({preserveComments: 'some'}))
|
||||||
|
.pipe(header(config.compiledTemplatesHeader))
|
||||||
|
.pipe(gulp.dest(config.pageStylesPath + '/' + dir + '/templates_compiled/client_side'))
|
||||||
|
.on('end', resolve)
|
||||||
|
.on('error', reject);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Watch styles
|
// Watch styles
|
||||||
gulp.task('watch', [], function(){
|
gulp.task('watch', [], function() {
|
||||||
gulp.watch(config.pageStylesPath + '/**/*.handlebars', ['page-styles']);
|
gulp.watch(config.pageStylesPath + '/**/*.handlebars', ['page-styles']);
|
||||||
gulp.watch(config.chatStylesPath + '/**/js/source/**/*.js', ['chat-styles-js']);
|
gulp.watch(config.chatStylesPath + '/**/js/source/**/*.js', ['chat-styles-js']);
|
||||||
gulp.watch(config.chatStylesPath + '/**/*.handlebars', ['chat-styles-handlebars']);
|
gulp.watch(config.chatStylesPath + '/**/*.handlebars', ['chat-styles-handlebars']);
|
||||||
|
Loading…
Reference in New Issue
Block a user