Transpilers Are Here To Stay

We have ES6 specification completed and is pending approval & the developers will steadily move toward using next generation JavaScript.
Spec:
http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts

ES6 next exit

But to keep ourselves up in the race we must start using ES6 features today as just learning & waiting for it to be supported across all major browsers will not help.

A good news that this specification comes up with is that we already have few features available under experimental support given by browsers like Google Chrome & some of them we were using already.

To make the support ready today, we need a tool called as transpiler. A transpiler converts code from one syntax form to another. Thus using a transpiler we can convert code written in JS v6 to JS v5, making us able to start writing code in ES6 syntax using new features without worrying about the browser support.

There are some transpilers already available, here are a few:

One that looks most promising as of date is Babel with detailed documentation & tutorials.

There are many transpilers and CLI tools available but most of them are not complete & are under development.
Addy osmani provides a detailed list here:
https://github.com/addyosmani/es6-tools

Babel allows you convert your JS6 code into JS5 syntax in their try it out editor.
Below is screenshot showing conversion of an example of  rest parameters.

In my current project I am using features like classes & de-structuring, by converting the code using try it out link. A CLI tool can facilitate this in a better way.

In brief, as the transpilers are yet under development & ES6 spec is yet to get approval with ES7 on the way, transpilers are here to stay.
Transpilers will have a long term usage for developers as we can’t expect the browsers to be ready & provide support for all the features immediately.
So start using ES6 today !!! 

References & further read:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s