Open agopshi opened 8 years ago
@dan-ld Make sure to include the runtime (see https://www.npmjs.com/package/gulp-babel#runtime and https://babeljs.io/docs/plugins/transform-runtime/).
@dan-ld Let's make this configurable. If config.js.babel
is set to false
, don't run the JS through the Babel compiler. This way, we can disable it for legal projects.
When you implement this, make sure it's working by writing some simple ES2015 and running it in the browser after Loewy Assets compiles it. E.g.
// using const
const arr1 = [1, 2, 3],
arr2 = [4, 5, 6];
// using spread operator to combine arrays
const combined = [...arr1, ...arr2];
console.log(combined); // should be [1, 2, 3, 4, 5, 6]
// using arrow functions
const double = x => 2 * x;
console.log(double(3)); // should be 6
Feel free to try other features as well.
Let's implement the Babel transpiler for the JS task. Should a simple one-line addition in
tasks/js.js
(before theconcat
call). Extract the Babel options inconfig.js.babel
, and provide sensible defaults (like{ presets: ['es2015'] }
).