Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khalyomede/fang-babel
Fang plugin to use babel.
https://github.com/khalyomede/fang-babel
babel es6 fang plugin transpile
Last synced: 9 days ago
JSON representation
Fang plugin to use babel.
- Host: GitHub
- URL: https://github.com/khalyomede/fang-babel
- Owner: khalyomede
- License: mit
- Created: 2019-03-30T14:36:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-30T14:44:11.000Z (almost 6 years ago)
- Last Synced: 2025-01-20T09:44:17.478Z (11 days ago)
- Topics: babel, es6, fang, plugin, transpile
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@khalyomede/fang-babel
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fang Babel
[Fang](https://www.npmjs.com/package/@khalyomede/fang-pug) plugin to use babel.
## Summary
- [Installation](#installation)
- [Usage](#usage)## Installation
1. Install [fang](https://www.npmjs.com/package/@khalyomede/fang-pug)
```bash
npm install --save-dev @khalyomede/fang@0.*
```2. Install this plugin
```bash
npm install --save-dev @khalyomede/fang-babel@0.*
```3. Create a task file (on the root of your folder)
```javascript
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');const js = () => fang.from('src/js/**/*.js')
.do(babel())
.save('dist/js');const build = [js];
module.exports = { build };
```## Usage
- [Example 1: simple usage](#example-1-simple-usage)
- [Example 2: with options](#example-2-with-options)### Example 1: simple usage
In this example, we will convert our javascript files to supports earlier browser using babel.
```javascript
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');const js = () => fang.from('src/js/**/*.js')
.do(babel())
.save('dist/js');const build = [js];
module.exports = { build };
```### Example 2: with options
In this example, we will ask babel to add an additional inlined source map using the options parameter of this plugin.
```javascript
// fang.js
const fang = require('@khalyomede/fang');
const babel = require('@khalyomede/fang-babel');const js = () => fang.from('src/js/**/*.js')
.do(babel({
sourceMaps: 'inline'
}))
.save('dist/js');const build = [js];
module.exports = { build };
```