1 | # pob-babel [![NPM version][npm-image]][npm-url]
|
2 |
|
3 | Build and watch with babel
|
4 |
|
5 | [![Dependency ci Status][dependencyci-image]][dependencyci-url]
|
6 | [![Dependency Status][daviddm-image]][daviddm-url]
|
7 |
|
8 | ### What it does
|
9 |
|
10 | - Transpiles js and jsx files for specific envs (pre-node6, node6, webpack 2, modern browsers webpack 2)
|
11 | - Transform yml files to json (for faster load)
|
12 | - Allow you to register plugins to transform more files by extension
|
13 | - `watch` returns an EventEmitter to allow you to restart your server if needed.
|
14 |
|
15 | ### Install
|
16 |
|
17 | ```sh
|
18 | npm install --save-dev pob-babel
|
19 | ```
|
20 |
|
21 | Also install babel plugins and presets
|
22 |
|
23 | Create .pob.json
|
24 |
|
25 | ```json
|
26 | {
|
27 | "react": false,
|
28 | "envs": ["node6", "webpack", "webpack-modern-browsers"],
|
29 | }
|
30 | ```
|
31 |
|
32 | ### How to use
|
33 |
|
34 | #### Direct use
|
35 |
|
36 | ```
|
37 | node_modules/.bin/pob-build
|
38 | node_modules/.bin/pob-watch
|
39 | ```
|
40 |
|
41 | #### With npm scripts `npm run build`
|
42 |
|
43 | Edit your package.json:
|
44 |
|
45 | ```json
|
46 | {
|
47 | "scripts": {
|
48 | "build": "pob-build",
|
49 | "watch": "pob-watch"
|
50 | }
|
51 | }
|
52 | ```
|
53 |
|
54 | [npm-image]: https://img.shields.io/npm/v/pob-babel.svg?style=flat-square
|
55 | [npm-url]: https://npmjs.org/package/pob-babel
|
56 | [daviddm-image]: https://david-dm.org/christophehurpeau/pob-babel.svg?style=flat-square
|
57 | [daviddm-url]: https://david-dm.org/christophehurpeau/pob-babel
|
58 | [dependencyci-image]: https://dependencyci.com/github/christophehurpeau/pob-babel/badge?style=flat-square
|
59 | [dependencyci-url]: https://dependencyci.com/github/christophehurpeau/pob-babel
|