snappymail/tasks/vendors.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-06-29 22:16:09 +08:00
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
2019-07-05 03:09:27 +08:00
const gulp = require('gulp');
const header = require('gulp-header');
const stripbom = require('gulp-stripbom');
2019-06-29 22:16:09 +08:00
2019-07-05 03:09:27 +08:00
const { config } = require('./config');
const { del } = require('./common');
2019-06-29 22:16:09 +08:00
// fontastic
const fontasticFontsClear = () => del('snappymail/v/' + config.devVersion + '/static/css/fonts/snappymail.*');
2019-06-29 22:16:09 +08:00
const fontasticFontsCopy = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('vendors/fontastic/fonts/snappymail.*')
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/css/fonts'));
2019-06-29 22:16:09 +08:00
const fontastic = gulp.series(fontasticFontsClear, fontasticFontsCopy);
// squire
const squireClear = () => del('snappymail/v/' + config.devVersion + '/static/squire');
2020-09-22 17:04:45 +08:00
const squire = gulp.series(squireClear);
2019-06-29 22:16:09 +08:00
// ckeditor
const ckeditorClear = () => del('snappymail/v/' + config.devVersion + '/static/ckeditor');
2019-06-29 22:16:09 +08:00
const ckeditorCopy = () =>
2019-07-05 03:09:27 +08:00
gulp
.src([
'vendors/ckeditor/**/*',
'!vendors/ckeditor/samples{,/**}',
'!vendors/ckeditor/adapters{,/**}',
'!vendors/ckeditor/*.md'
])
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/ckeditor'));
2019-06-29 22:16:09 +08:00
const ckeditorCopyPlugins = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('vendors/ckeditor-plugins/**/*')
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/ckeditor/plugins'));
2019-06-29 22:16:09 +08:00
const ckeditorSetup = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('snappymail/v/' + config.devVersion + '/static/ckeditor/*.js')
2019-06-29 22:16:09 +08:00
.pipe(stripbom())
// eslint-disable-next-line quotes
2019-07-05 03:09:27 +08:00
.pipe(header('\uFEFF')) // BOM
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/ckeditor'));
2019-06-29 22:16:09 +08:00
const ckeditor = gulp.series(ckeditorClear, ckeditorCopy, ckeditorCopyPlugins, ckeditorSetup);
exports.vendors = gulp.parallel(squire, ckeditor, fontastic);