Grunt babel for Magento 2
Forked from grunt-babel
$ npm install --save-dev grunt-m2babel @babel/core @babel/preset-env
$ yarn add --dev grunt-m2babel @babel/core @babel/preset-env
Prepare source files in a theme's folder
Add all source scripts to the folder in all modules
web/js/source of a created theme.
Will be compiled to
grunt-m2babel will run for all themes which added to
if the file
local-themes.js was added to a content of the file
grunt-config.json in the root folder of a project.
How to use
Now you can use ES6 syntax in any files in your theme which added to the folder
web/js/source/**/*.js in any modules of your theme.
Just run the command in a terminal to build scripts:
The config of the Grunt’s watcher has been rewritten and after adding changes for scripts in source folders of your theme scripts will be rebuilt.
Just run the watcher via the command in a terminal: