ES6 with Babel and Gulp
Out Of Date Warning
This article was published on 10 Mar 2016, this means the content may be out of date or no longer relevant. You should verify that the technical information in this article is still current before relying upon it for your own purposes.
First, make sure we have the latest versions of both cli and local version of gulp:
Creating an ES6 gulpfile
To use ES6 we need to have installed Babel as a dependency to our project, with es2015 plugin preset:
We can specify preset with the command option or simply create .babelrc file:
Then we need to tell gulp to use Babel.It can be done by renaming gulpfile.js
to gulpfile.babel.js
:
And that’s it. Now we can use ES6 syntax via Babel, for example some sort of gulpfile: