I have the following Coffeescript in test.js
yo () -> console.log("yo")
When compiled via coffee -o public/javascripts/ -cw public/coffeescripts/, I get public/javascripts/test.js:
// Generated by CoffeeScript 1.4.0
(function() {
var yo;
yo = function() {
return console.log('yo');
};
}).call(this);
I'm trying to include this in the usual way in an HTML file:
<script src="/javascripts/test.js" type="text/javascript"></script>
<script type='text/javascript'>
//<![CDATA[
$(function() {
alert('before yo');
yo();
alert('after yo');
});
//]]>
</script>
However I keep getting "Uncaught Reference Error: yo is not defined". Whats the process for actually using the javascript generated by Coffeescript?