Skip to content

Commit

Permalink
Add babel to gulp buildDev workflow for js compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Braz authored and Jon Braz committed Aug 8, 2019
1 parent 2ba329f commit a819932
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 31 deletions.
16 changes: 16 additions & 0 deletions gulp/tasks/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import gulp from 'gulp';
import uglify from 'gulp-uglify';
import eslint from 'gulp-eslint';
import { app, src, tmp } from '../paths.js';
import babel from 'gulp-babel';

const config = {
app: {
Expand Down Expand Up @@ -53,3 +54,18 @@ export const lint = () => gulp
.src(context.lint)
.pipe(eslint())
.pipe(eslint.format());

/**
* Compile with Babel
*/
export const compileJs = () => gulp
.src([
join(tmp, 'apps', '**', '*.js'),
])
.pipe(babel({
babelrc: false,
ignore: ['**/node_modules'],
plugins: ['babel-plugin-transform-object-rest-spread'],
presets: ['env']
}))
.pipe(gulp.dest(join(tmp, 'apps')));
3 changes: 2 additions & 1 deletion gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { serve, watch } from './gulp/tasks/server.js';
import gulp from 'gulp';
import require from './gulp/tasks/require.js';
import writeVersion from './gulp/tasks/write-version.js';
import { lint, minifyJs, minifyJsApp } from './gulp/tasks/javascript.js';
import { lint, minifyJs, minifyJsApp, compileJs } from './gulp/tasks/javascript.js';
import { templates, templatesApp } from './gulp/tasks/templates.js';
import { compileSass, css, minifyCssApp } from './gulp/tasks/style.js';
import {
Expand All @@ -20,6 +20,7 @@ const buildProd = gulp.series(
moveFilesToTmp,
compileSass,
templates,
compileJs,
require,
minifyJs,
css,
Expand Down
77 changes: 47 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dependencies": {},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"browser-sync": "^2.26.7",
Expand All @@ -30,6 +31,7 @@
"eslint-plugin-promise": "^4.0.0",
"eslint-plugin-standard": "^4.0.0",
"gulp": "^4.0.0",
"gulp-babel": "^7.0.0",
"gulp-cached": "^1.1.1",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
Expand Down

0 comments on commit a819932

Please sign in to comment.