With ES6 having gained more common usage, I'm finding wanting to write functions in main.js in it by default, so we can leverage the neater syntax and keep more up to date with the now popularly adopted syntax. There are a few ways we could go about this. Here are two :
Switch to a webpack + babel setup . Pretty much everything our current gulpfile does can be done in webpack + plugins. One of the plugins would be the babel transpiler. We've done something like this for some of our static sites. We can setup a rough webpack equivalent to the gulpfile.js, including the transpiling steps.
If keeping gulp is a must, it has babel friendly setups as well, like say gulp-babel.
I tend to lean toward the former since it seems more popular? But open to thoughts (including whether to even do this in this theme or a separate one? , etc.).
With ES6 having gained more common usage, I'm finding wanting to write functions in main.js in it by default, so we can leverage the neater syntax and keep more up to date with the now popularly adopted syntax. There are a few ways we could go about this. Here are two :
Switch to a webpack + babel setup . Pretty much everything our current gulpfile does can be done in webpack + plugins. One of the plugins would be the babel transpiler. We've done something like this for some of our static sites. We can setup a rough webpack equivalent to the gulpfile.js, including the transpiling steps.
If keeping gulp is a must, it has babel friendly setups as well, like say gulp-babel.
I tend to lean toward the former since it seems more popular? But open to thoughts (including whether to even do this in this theme or a separate one? , etc.).