mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
update gulp and gulpfile
This commit is contained in:
parent
a1562e7145
commit
b244462fa5
19 changed files with 1570 additions and 1044 deletions
41
tasks/webpack.js
Normal file
41
tasks/webpack.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||
const webpack = require('webpack');
|
||||
const gutil = require('gulp-util');
|
||||
|
||||
const {config} = require('./config');
|
||||
|
||||
const webpackCfgBuilder = require('../webpack.config.builder.js');
|
||||
|
||||
const webpackError = (err) => {
|
||||
if (err) {
|
||||
gutil.log('[webpack]', '---');
|
||||
gutil.log('[webpack]', err.error ? err.error.toString() : '');
|
||||
gutil.log('[webpack]', err.message || '');
|
||||
gutil.log('[webpack]', '---');
|
||||
}
|
||||
};
|
||||
|
||||
const webpackCallback = (done) => (err, stats) => {
|
||||
if (err) {
|
||||
if (config.watch) {
|
||||
webpackError(err);
|
||||
} else {
|
||||
throw new gutil.PluginError('webpack', err);
|
||||
}
|
||||
} else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0]) {
|
||||
if (config.watch) {
|
||||
stats.compilation.errors.forEach(webpackError);
|
||||
} else {
|
||||
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
|
||||
}
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
exports.webpack = (done) => {
|
||||
webpack(
|
||||
webpackCfgBuilder(config.paths.staticJS, !config.community, 'production'),
|
||||
webpackCallback(done)
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue