javascript - 如何破解 LiveScript 以链接 html 中的单独文件

标签 javascript html coffeescript livescript

我们可以在 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/

相关文章:

javascript - HTML5 是否允许拖放上传文件夹或文件夹树?

jquery - Animated.css 动画在窗口滚动使用 jQuery

javascript - 将大文件存储在 chromecast 内存中

javascript - setInterval() 不是删除之前绘制的图像

node.js - Coffeescript - 如何调用作用域链上两层的方法?

javascript - 数组(json)没有传递到 jqGrid 的编辑选项参数中

javascript - 使用 jquery 将单个值分配给具有相同类名的文本字段

javascript - 如何实现上滑效果并重定向到另一个html页面

javascript - 可链式推送()?

javascript - CoffeeScript/jQuery 语法可以更简单吗?