Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transpile inline/embedded javascript using babel?

Tags:

babeljs

I use "babel" command to transpile ES6 script to ES5.

Ex: babel testES6.js --out-file testES5.js

It works fine. My question is how to transpile inline javascript. For Ex: test.html

<html>
   <head>
      <script type="text/javascript">
          //ES6 scripts
      </script>
   </head>
</html>
like image 852
Karthik Bose Avatar asked May 08 '15 09:05

Karthik Bose


1 Answers

According the babel docs, it supports scripts typed text/ecmascript-6 or text/babel. Add the browser build into your page and set proper type for your scripts.

like image 110
just-boris Avatar answered Nov 03 '22 00:11

just-boris