Skip to main content

Writing a Gulpfile in ES6

3/30/20161 min read

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.

© 2021 by Madole.
GitHub Repository
Last build: 1662286611335