鍍金池/ 問答/HTML/ 不用框架和打包工具,如何使用babel?

不用框架和打包工具,如何使用babel?

有一些簡(jiǎn)單的頁面,不適合上各種框架,但想使用ES6以上的語法,
能不能像一些模版引擎一樣,直接在html引入文件,下面就直接可以寫特殊語法?

回答
編輯回答
青檸

https://github.com/babel/babe...

<div id="output"></div>
<!-- Load Babel -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- Your custom script here -->
<script type="text/babel">
const getMessage = () => "Hello World";
document.getElementById('output').innerHTML = getMessage();
</script>
2018年7月1日 13:40
編輯回答
空痕
2017年12月8日 14:28
編輯回答
避風(fēng)港

有另外一種庫(kù)支持你的需求 直接瀏覽器引用的,名字我忘了···你自己搜索下吧

2017年11月6日 14:45