Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-babel
Use Babel transpile ES6+ file to ES5
https://github.com/thinkjs/think-babel
babel thinkjs3 transpile
Last synced: about 12 hours ago
JSON representation
Use Babel transpile ES6+ file to ES5
- Host: GitHub
- URL: https://github.com/thinkjs/think-babel
- Owner: thinkjs
- License: mit
- Created: 2017-02-13T11:51:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-01T00:05:32.000Z (over 3 years ago)
- Last Synced: 2024-04-29T12:22:47.964Z (6 months ago)
- Topics: babel, thinkjs3, transpile
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# think-babel
[![Build Status](https://travis-ci.org/thinkjs/think-babel.svg?branch=master)](https://travis-ci.org/thinkjs/think-babel)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-babel/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-babel?branch=master)
[![npm](https://img.shields.io/npm/v/think-babel.svg?style=flat-square)](https://www.npmjs.com/package/think-babel)`think-babel` transpile ES6+ file to ES5
## Syntax
```js
import thinkBabel from 'think-babel';
thinkBabel({
srcPath,
outPath,
file,
options,
ext,
});```
- `srcPath` {String} the file source path.
- `outPath` {String} the directory for output file.
- `file` {String} the file path in the 'srcPath'.
- `[options]` {Object} the babel options,default
```js
{
filename: file,
sourceFileName: path.join(srcPath, file),
presets: ['es2015'],
sourceMaps: true,
babelrc: false
}
```
- `[ext]` {String} the new file extension,default `.js`.## Usage
Transform ES6+ file to ES5:
```js
import thinkBabel from 'think-babel';thinkBabel({
srcPath: './test/src/a',
outPath: './test/out',
file: 'b/test.es'
});```