Added Babel transpilation support to the gulp workflow

This commit is contained in:
Alex Tselegidis 2021-11-07 10:38:18 +01:00
parent e979f08215
commit 70625e37a5
4 changed files with 1474 additions and 8 deletions

3
babel.config.json Normal file
View file

@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}

View file

@ -9,15 +9,16 @@
* @since v1.4.0 * @since v1.4.0
* ---------------------------------------------------------------------------- */ * ---------------------------------------------------------------------------- */
const babel = require('gulp-babel');
const changed = require('gulp-changed'); const changed = require('gulp-changed');
const childProcess = require('child_process'); const childProcess = require('child_process');
const sass = require('gulp-sass')(require('sass'));
const css = require('gulp-clean-css'); const css = require('gulp-clean-css');
const del = require('del'); const del = require('del');
const fs = require('fs-extra'); const fs = require('fs-extra');
const gulp = require('gulp'); const gulp = require('gulp');
const plumber = require('gulp-plumber'); const plumber = require('gulp-plumber');
const rename = require('gulp-rename'); const rename = require('gulp-rename');
const sass = require('gulp-sass')(require('sass'));
const uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
const zip = require('zip-dir'); const zip = require('zip-dir');
@ -82,13 +83,16 @@ function clean(done) {
} }
function scripts() { function scripts() {
return gulp return (
.src(['assets/js/**/*.js', '!assets/js/**/*.min.js']) gulp
.pipe(plumber()) .src(['assets/js/**/*.js', '!assets/js/**/*.min.js'])
.pipe(changed('assets/js/**/*')) .pipe(plumber())
.pipe(uglify().on('error', console.log)) .pipe(changed('assets/js/**/*'))
.pipe(rename({suffix: '.min'})) .pipe(babel())
.pipe(gulp.dest('assets/js')); // .pipe(uglify().on('error', console.log))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('assets/js'))
);
} }
function styles() { function styles() {

1456
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -37,9 +37,12 @@
"trumbowyg": "^2.21.0" "trumbowyg": "^2.21.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"del": "^6.0.0", "del": "^6.0.0",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-changed": "^3.2.0", "gulp-changed": "^3.2.0",
"gulp-clean-css": "^3.10.0", "gulp-clean-css": "^3.10.0",
"gulp-debug": "^4.0.0", "gulp-debug": "^4.0.0",