Skip to content

Instantly share code, notes, and snippets.

@ppurang
Created August 14, 2013 07:43
Show Gist options
  • Save ppurang/6228786 to your computer and use it in GitHub Desktop.
Save ppurang/6228786 to your computer and use it in GitHub Desktop.
Livescript on the client - an html file and a test script
<!DOCTYPE html>
<html lang="en">
<head>
<title>livescript</title>
</head>
<body>
<h1>
Livescript - check the browser's console
</h1>
<h2>
Prepare
</h2>
<p>
Provide a valid location for the livescript js file. Search for an HTML comment with '???' and do the needful.
</p>
<h2>
Chrome
</h2>
<p>
If you are picking up the files from the filesystem (e.g. src="js/livescript.js") use the following command
to start the browser<br/>
<pre>
google-chrome --allow-file-access-from-files &
</pre>
</p>
<h2>
Expected output
</h2>
<p>
<pre>
LiveScript up
6
end
</pre>
</p>
<script type="text/ls" src="test.ls"></script>
<script src="http://gkz.github.io/prelude-ls/prelude-browser-min.js"></script>
<!-- ??? replace the following to point to a better url .. cdnjs doesn't have livescript 1.2.0 yet-->
<script src="js/livescript.js"></script>
</body>
</html>
console ?.log 'LiveScript up'
prelude = require 'prelude-ls'
{map, fold1} = prelude
console.log(fold1 (+), [1 to 3])
# if jquery is available
#$ \h1 .find \img .prop \src, "bla"
console ?.log \end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment