Is there a way to send CoffeeScript to the client's browser and have it compiled to JavaScript *there*?

Is there a way to send CoffeeScript to the client's browser and have it compiled to JavaScript there?

<script type="text/coffeescript">
    square = (x) -> x * x
    list = [1, 2, 3, 4, 5]        
    squares = (square num for num in list)
</script>

The CoffeeScript compiler is written in JavaScript, so can I send it to the client to compile/run this code in the client's browser?

37
задан Phat Albert 2 March 2011 в 16:54
поделиться