1. Create css(style.css), js(main.js) and index.html and 'dist'(a directory where babel will compile the es6 file to javascript file)
- npm init (add all intial info and save into package.json in your project)
- npm install babel-cli babel-core --save-dev (to install Babel CLI locally in the project)
- npm install babel-preset-es2015 --save-dev
- "build": "babel js -d dist"
This will set the project so that babel can convert any code written in es6(js/) to javascript code(dist/).
- This will set *preset* plugin of babel to es2015.
Now, you can check if your babel is working or not. Add some es6 code in js/main.js and run npm run build in your project's root directory. A vanilla javascript file will be created by babel in your dist directory after converting es6 file.
- Download the zip or fork the porject
- run index.html