项目作者: babel

项目描述 :
Grunt plugin for Babel
高级语言: JavaScript
项目地址: git://github.com/babel/grunt-babel.git
创建时间: 2014-10-06T10:37:53Z
项目社区:https://github.com/babel/grunt-babel

开源协议:MIT License

下载


This readme is for grunt-babel v8 + Babel v7
Check the 7.x branch for docs with Babel v6

grunt-babel Build Status

Use next generation JavaScript, today, with Babel

Issues with the output should be reported on the Babel issue tracker.

Install

For Babel 7.x and grunt-babel v8

  1. $ yarn add --dev grunt-babel @babel/core @babel/preset-env

For Babel 6.x and grunt-babel v7

  1. $ yarn add --dev grunt-babel@7 babel-core babel-preset-env

Note: See the 7.x branch for more examples of
usage of Babel 6.x. This README is primarily applicable for Babel 7.x

Usage

Option with load-grunt-tasks

  1. require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
  2. grunt.initConfig({
  3. babel: {
  4. options: {
  5. sourceMap: true,
  6. presets: ['@babel/preset-env']
  7. },
  8. dist: {
  9. files: {
  10. 'dist/app.js': 'src/app.js'
  11. }
  12. }
  13. }
  14. });
  15. grunt.registerTask('default', ['babel']);

Option with loadNpmTasks

  1. grunt.initConfig({
  2. babel: {
  3. options: {
  4. sourceMap: true,
  5. presets: ['@babel/preset-env']
  6. },
  7. dist: {
  8. files: {
  9. 'dist/app.js': 'src/app.js'
  10. }
  11. }
  12. }
  13. });
  14. grunt.loadNpmTasks('grunt-babel');
  15. grunt.registerTask('default', ['babel']);

Options

See the Babel options, except for filename which is handled for you.

License

MIT © Sindre Sorhus