Writing a Gulpfile in ES6

☠️ Out of date - 2 years old ️️☠️

So you’ve written your app in ES6 and you’re using babel to transpile to ES5.

But your build process uses Gulp and it requires you to write your Gulpfile in ES5 meaning you can’t take advantage of all the latest JavaScript features you’re using elsewhere in your project.

What do you do?

You could go down the route of requiring in the babel register at the top of your Gulpfile to get it to transpile on the fly.


But there is some built in functionality in Gulp which allows your to name your Gulpfile gulpfile.babel.js.

Doing this will make Gulp look for a .babelrc and run your gulpfile via babel to get all the latest ES6/7 goodies you’re using in the rest of your codebase.

Written by who lives and works in Sydney building 3D maps in the browser.