Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-babel

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-babel

Turn ES6 code into vanilla ES5 with no runtime required

  • 5.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
226K
decreased by-10.59%
Maintainers
2
Weekly downloads
 
Created

What is gulp-babel?

The gulp-babel package is a Gulp plugin that allows you to use Babel to transpile your JavaScript files. Babel is a JavaScript compiler that lets you use next-generation JavaScript, today. It can transform syntax, polyfill features that are missing in your target environment, and more.

What are gulp-babel's main functionalities?

Transpile ES6 to ES5

This feature allows you to transpile ES6 JavaScript code to ES5, making it compatible with older browsers. The code sample demonstrates a Gulp task that reads a JavaScript file from the 'src' directory, uses Babel to transpile it, and then writes the output to the 'dist' directory.

const gulp = require('gulp');
const babel = require('gulp-babel');

gulp.task('default', () => {
  return gulp.src('src/app.js')
    .pipe(babel({
      presets: ['@babel/env']
    }))
    .pipe(gulp.dest('dist'));
});

Use Babel plugins

This feature allows you to use specific Babel plugins to transform your code. The code sample demonstrates a Gulp task that uses the Babel plugin for transforming arrow functions.

const gulp = require('gulp');
const babel = require('gulp-babel');

gulp.task('default', () => {
  return gulp.src('src/app.js')
    .pipe(babel({
      plugins: ['@babel/plugin-transform-arrow-functions']
    }))
    .pipe(gulp.dest('dist'));
});

Source Maps

This feature allows you to generate source maps for your transpiled code, which can be very useful for debugging. The code sample demonstrates a Gulp task that initializes source maps, transpiles the code using Babel, and then writes the source maps to the 'dist' directory.

const gulp = require('gulp');
const babel = require('gulp-babel');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('default', () => {
  return gulp.src('src/app.js')
    .pipe(sourcemaps.init())
    .pipe(babel({
      presets: ['@babel/env']
    }))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('dist'));
});

Other packages similar to gulp-babel

Keywords

FAQs

Package last updated on 15 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc