This readme is for gulp-babel v8 + Babel v7 Check the 7.x branch for docs with Babel v6 usage
gulp-babel
Use next generation JavaScript, today, with Babel
Issues with the output should be reported on the Babel issue tracker.
Install
Install gulp-babel
if you want to get the pre-release of the next version of gulp-babel
.
# Babel 7
$ npm install --save-dev gulp-babel @babel/core @babel/preset-env
# Babel 6
$ npm install --save-dev gulp-babel@7 babel-core babel-preset-env
Usage
const gulp = ;const babel = ; gulp;
API
babel([options])
options
See the Babel options, except for sourceMap
and filename
which is handled for you.
Source Maps
Use gulp-sourcemaps like this:
const gulp = ;const sourcemaps = ;const babel = ;const concat = ; gulp;
Babel Metadata
Files in the stream are annotated with a babel
property, which contains the metadata from babel.transform()
.
Example
const gulp = ;const babel = ;const through = ; { return through;} gulp
Runtime
If you're attempting to use features such as generators, you'll need to add transform-runtime
as a plugin, to include the Babel runtime. Otherwise, you'll receive the error: regeneratorRuntime is not defined
.
Install the runtime:
$ npm install --save-dev @babel/plugin-transform-runtime
$ npm install --save @babel/runtime
Use it as plugin:
const gulp = ;const babel = ; gulp;
License
MIT © Sindre Sorhus