Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 30, 2015
1 parent 9772e55 commit 54c583e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 30 deletions.
12 changes: 0 additions & 12 deletions .jshintrc

This file was deleted.

29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
{
"name": "grunt-babel",
"version": "5.0.3",
"description": "Turn ES6 code into vanilla ES5 with no runtime required",
"description": "Use next generation JavaScript, today",
"license": "MIT",
"repository": "babel/grunt-babel",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt"
"test": "xo && grunt"
},
"files": [
"tasks"
],
"keywords": [
"gruntplugin",
"babel",
"transpiler",
"es2015",
"es6",
"rewriting",
"transformation",
"syntax",
"codegen",
"desugaring",
"javascript",
"ecmascript",
"language",
"es5",
"es6",
"ES.next",
"harmony",
"compiler",
"transpiler",
"babel"
"compiler"
],
"dependencies": {
"babel-core": "^6.0.2"
"babel-core": "^6.0.12"
},
"devDependencies": {
"babel-preset-es2015": "^6.0.11",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-nodeunit": "^0.4.1"
"grunt-contrib-nodeunit": "^0.4.1",
"xo": "*"
},
"xo": {
"ignores": [
"test/fixture.js"
]
}
}
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# grunt-babel [![Build Status](https://travis-ci.org/babel/grunt-babel.svg?branch=master)](https://travis-ci.org/babel/grunt-babel)

> Turn ES6 code into vanilla ES5 with no runtime required using [babel](https://github.com/babel/babel)
> Use next generation JavaScript, today, with [Babel](https://babeljs.io)
*Issues with the output should be reported on the babel [issue tracker](https://github.com/babel/babel/issues).*
*Issues with the output should be reported on the Babel [issue tracker](https://github.com/babel/babel/issues).*


## Install
Expand Down Expand Up @@ -37,7 +37,7 @@ grunt.registerTask('default', ['babel']);

## Options

See the `babel` [options](https://babeljs.io/docs/usage/options), except for `filename` which is handled for you.
See the Babel [options](https://babeljs.io/docs/usage/options), except for `filename` which is handled for you.


## License
Expand Down
6 changes: 4 additions & 2 deletions tasks/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ var path = require('path');
var babel = require('babel-core');

module.exports = function (grunt) {
grunt.registerMultiTask('babel', 'Transpile ES6 to ES5', function () {
grunt.registerMultiTask('babel', 'Use next generation JavaScript, today', function () {
var options = this.options();

this.files.forEach(function (el) {
delete options.filename;
delete options.filenameRelative;

options.sourceFileName = path.relative(path.dirname(el.dest), el.src[0]);

if (process.platform === 'win32') {
options.sourceFileName = options.sourceFileName.replace(/\\/g, '/');
}

options.sourceMapTarget = path.basename(el.dest);

var res = babel.transformFileSync(el.src[0], options);

var sourceMappingURL = '';

if (res.map) {
sourceMappingURL = '\n//# sourceMappingURL=' + path.basename(el.dest) + '.map';
}
Expand Down

0 comments on commit 54c583e

Please sign in to comment.