snappymail/tasks/vendors.js

65 lines
2.2 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
// moment
const momentLocalesClear = () => del('rainloop/v/' + config.devVersion + '/app/localization/moment/*.js');
2019-07-05 03:09:27 +08:00
const momentLocales = () => gulp.src(config.paths.js.moment.locales).pipe(gulp.dest(config.paths.momentLocales));
2019-06-29 22:16:09 +08:00
const moment = gulp.series(momentLocalesClear, momentLocales);
// lightgallery
const lightgalleryFontsClear = () => del('rainloop/v/' + config.devVersion + '/static/css/fonts/lg.*');
const lightgalleryFontsCopy = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('vendors/lightgallery/dist/fonts/lg.*')
2019-06-29 22:16:09 +08:00
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/css/fonts'));
const lightgallery = gulp.series(lightgalleryFontsClear, lightgalleryFontsCopy);
// fontastic
const fontasticFontsClear = () => del('rainloop/v/' + config.devVersion + '/static/css/fonts/rainloop.*');
const fontasticFontsCopy = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('vendors/fontastic/fonts/rainloop.*')
2019-06-29 22:16:09 +08:00
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/css/fonts'));
const fontastic = gulp.series(fontasticFontsClear, fontasticFontsCopy);
// ckeditor
const ckeditorClear = () => del('rainloop/v/' + config.devVersion + '/static/ckeditor');
const ckeditorCopy = () =>
2019-07-05 03:09:27 +08:00
gulp
.src([
'vendors/ckeditor/**/*',
'!vendors/ckeditor/samples{,/**}',
'!vendors/ckeditor/adapters{,/**}',
'!vendors/ckeditor/*.md'
])
2019-06-29 22:16:09 +08:00
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor'));
const ckeditorCopyPlugins = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('vendors/ckeditor-plugins/**/*')
2019-06-29 22:16:09 +08:00
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor/plugins'));
const ckeditorSetup = () =>
2019-07-05 03:09:27 +08:00
gulp
.src('rainloop/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
2019-06-29 22:16:09 +08:00
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor'));
const ckeditor = gulp.series(ckeditorClear, ckeditorCopy, ckeditorCopyPlugins, ckeditorSetup);
exports.vendors = gulp.parallel(moment, ckeditor, fontastic, lightgallery);