Skip to content

Commit

Permalink
πŸ“¦ NEW: Add ES6 support to WPGulp using gulp-babel β€” Merge PR #80
Browse files Browse the repository at this point in the history
 β€” Merge PR #80
  • Loading branch information
Ahmad Awais ⚑️ authored Jan 13, 2018
2 parents 8bfaf67 + 8a1bc78 commit 5f038f8
Show file tree
Hide file tree
Showing 3 changed files with 980 additions and 133 deletions.
23 changes: 23 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var mmq = require( 'gulp-merge-media-queries' ); // Combine matching media queri
// JS related plugins.
var concat = require( 'gulp-concat' ); // Concatenates JS files
var uglify = require( 'gulp-uglify' ); // Minifies JS files
var babel = require( 'gulp-babel' ); // Compiles ESNext to browser compatible JS.

// Image realted plugins.
var imagemin = require( 'gulp-imagemin' ); // Minify PNG, JPEG, GIF and SVG images with imagemin.
Expand Down Expand Up @@ -153,6 +154,17 @@ gulp.task( 'styles', function() {
*/
gulp.task( 'vendorsJS', function() {
return gulp.src( config.jsVendorSRC )
.pipe(
babel({
presets: [
[ 'env', // Preset which compiles ES6 to ES5.
{
'targets': { 'browsers': config.BROWSERS_LIST }, // Target browser list to support.
}
]
]
})
)
.pipe( concat( config.jsVendorFile + '.js' ) )
.pipe( lineec() ) // Consistent Line Endings for non UNIX systems.
.pipe( gulp.dest( config.jsVendorDestination ) )
Expand Down Expand Up @@ -181,6 +193,17 @@ gulp.task( 'vendorsJS', function() {
*/
gulp.task( 'customJS', function() {
return gulp.src( config.jsCustomSRC )
.pipe(
babel({
presets: [
[ 'env', // Preset which compiles ES6 to ES5.
{
'targets': { 'browsers': config.BROWSERS_LIST }, // Target browser list to support.
}
]
]
})
)
.pipe( concat( config.jsCustomFile + '.js' ) )
.pipe( lineec() ) // Consistent Line Endings for non UNIX systems.
.pipe( gulp.dest( config.jsCustomDestination ) )
Expand Down
Loading

0 comments on commit 5f038f8

Please sign in to comment.