ceremcem
ceremcem

Reputation: 4360

How to hack LiveScript in order to link a separate file in html

We could include separate coffee-script file in html with:

<script type="text/coffeescript" src="/static/webpage.coffee"></script>

But if we want to use LiveScript in browser, they say:

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".

I need exact same include technique we used to use for coffee-script or Javascript. So, is there anyone give me a tip to start hacking?

Upvotes: 1

Views: 432

Answers (1)

Oleh Prypin
Oleh Prypin

Reputation: 34126

Looking at LiveScript.go() in src/browser.ls (browser/livescript.js) it is apparent that external files are actually supported. Indeed, the following worked for me:

<head>
    <script src="livescript-min.js"></script>
    <script type="text/ls" src="script.ls"></script>
    <script>
        require('LiveScript').go();
    </script>
</head>

Upvotes: 1

Related Questions