我们可以在 html 中包含单独的 CoffeeScript 文件:
<script type="text/coffeescript" src="/static/webpage.coffee"></script>
但是如果我们想在浏览器中使用 LiveScript,他们会说:
If you use this, your LiveScript scripts must be inline (not linked to with the src attribute), be placed after the included livescript.js file, and the script tags must have the attribute type="text/ls".
我需要与我们用于 CoffeeScript 或 Javascript 完全相同的包含技术。那么,有人给我一些开始黑客攻击的建议吗?
最佳答案
查看 src/browser.ls 中的 LiveScript.go()
( browser/livescript.js ) 显然外部文件实际上是受支持的。事实上,以下内容对我有用:
<head>
<script src="livescript-min.js"></script>
<script type="text/ls" src="script.ls"></script>
<script>
require('LiveScript').go();
</script>
</head>
关于javascript - 如何破解 LiveScript 以链接 html 中的单独文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26808015/