Closed cburschka closed 8 years ago
babeljs is an npm package, which would probably be easier to include in the build process if we managed to do #194.
Okay so actually babel works JUST FINE with makefiles. Which is awesome.
All we need is a refactored source tree that clearly separates source JS from build JS. Eg. src/ and build/.
The libraries are fine (except for jquery-replacetext, which is an easy fix), so keep those separately. In fact we need to, because retranslating them through ES2015 will break stuff.
Then install build/ and lib/ and everything back under something like assets/js
.
This issue was solved some time in early June, when babeljs was added to the Makefile.
All that is needed now is to update the README with the new workflow - there's probably a npm install
required now, or something.
1.12.0 is using tons of ES2015 language constructs. New iterators, arrow functions, const/let declarations, destructuring, the works.
It turns out that this is only supported by browser versions released a few months ago, which stretches even my willingness to break compatibility.
Fortunately, there is a tool that allows ES2015 code to run in ES5 engines, using a source-translator and a polyfill. https://babeljs.io/
Add this to the build process, provide a "--babel" configuration key and we're good.