Mibew / mibew

Mibew Messenger - open-source live support application
https://mibew.org
Other
473 stars 204 forks source link

gulpfile changes #179

Closed revazi closed 7 years ago

revazi commented 8 years ago

Compiles all styles not only default. Added 'watch' task for development.

JustBlackBird commented 8 years ago

Why did you choose Q instead of Native promises implementation (may be with a polyfill) or something with similar API (like Bluebird)?

revazi commented 8 years ago

I'm not doing anything special with Q. We can change the Q to native promises, implement deferred object and replace Q with Promise

Promise.defer = function() {
  var result = {};
  result.promise = new Promise(function(resolve, reject) {
    result.resolve = resolve;
    result.reject = reject;
  });
  return result;
};

or we can just push new promises in the array directly, like so

promises.push(new Promise(function(resolve, reject){
  var pipeline = gulp.src(config.chatStylesPath + '/' + dir + '/js/source/**/*.js')
    .pipe(concat('scripts.js'))
    .pipe(uglify({preserveComments: 'some'}))
    .pipe(gulp.dest(config.chatStylesPath + '/' + dir + '/js/compiled'));
  pipeline.on('end', resolve);
  pipeline.on('error', reject);
}));
faf commented 7 years ago

Thanks @revazi, your code has been merged in #195.