1 | # pob-babel
|
2 |
|
3 | Build and watch with babel
|
4 |
|
5 | ### What it does
|
6 |
|
7 | - Transpiles js and jsx files for specific envs (pre-node6, node6, webpack 2, modern browsers webpack 2)
|
8 | - Transform yml files to json (for faster load)
|
9 | - Allow you to register plugins to transform more files by extension
|
10 | - `watch` returns an EventEmitter to allow you to restart your server if needed.
|
11 |
|
12 | ### Install
|
13 |
|
14 | ```sh
|
15 | npm install --save-dev pob-babel
|
16 | ```
|
17 |
|
18 | Also install babel plugins and presets
|
19 |
|
20 | Create .pobrc.js
|
21 |
|
22 | ```js
|
23 | module.exports = {
|
24 | react: false,
|
25 | envs: ['es5', 'node6', 'webpack', 'webpack-modern-browsers'],
|
26 | };
|
27 | ```
|
28 |
|
29 | ### How to use
|
30 |
|
31 | #### Direct use
|
32 |
|
33 | ```
|
34 | node_modules/.bin/pob-build
|
35 | node_modules/.bin/pob-watch
|
36 | ```
|
37 |
|
38 | #### With npm scripts `npm run build`
|
39 |
|
40 | Edit your package.json:
|
41 |
|
42 | ```json
|
43 | {
|
44 | "scripts": {
|
45 | "build": "pob-build",
|
46 | "watch": "pob-watch"
|
47 | }
|
48 | }
|
49 |
|
50 | ```
|