Skip to content

mmiszy/grunt-babel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-babel Build Status

Use next generation JavaScript, today, with Babel

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

Install

$ npm install --save-dev grunt-babel babel-preset-es2015

Usage

require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

grunt.initConfig({
	babel: {
		options: {
			sourceMap: true,
			presets: ['es2015']
		},
		dist: {
			files: {
				'dist/app.js': 'src/app.js'
			}
		}
	}
});

grunt.registerTask('default', ['babel']);

Options

See the Babel options, except for filename which is handled for you and inputSourceMap (see below).

inputSourceMap

inputSourceMap option should be a function which takes two arguments and returns path to the existing source map.

grunt.initConfig({
	babel: {
		options: {
			inputSourceMap: function (el, sourceFileName) {
				return return el.src[0].replace(/\.js$/, '.js.map');
			}
		}
	}
});

License

MIT © Sindre Sorhus

About

Grunt plugin for Babel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%