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

gulp-babel

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-babel

Use next generation JavaScript, today

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
298K
decreased by-11.71%
Maintainers
7
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 28 Aug 2018

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