Simple coffeescript webpage

I saw coffescript tutorials that show how to use coffeescript with rails, nodejs, or even coffeescript REPL to learn it.

How to create a web project where I can just write a cofeescript script inside an HTML page, I mean something like

<script type ="text/coffeescript"> //some coffeescript code </script> 

How to use coffeescript when developing websites? just includes javascript output and validation of it. But I do not want to do this (I feel that this is just awkward).

I also saw the coffeescript website, it has a small number of directions in this regard, it says -

enter image description here

I tried, I included these scripts along with jquery. But my page remains blank. Has anyone done this before, can you provide some sample code?

Thanks.

+4
source share
1 answer

Just enable coffee-script.js usual way, and then add <script> elements like this:

 <script type="text/coffeescript"> alert 'pancakes!' </script> 

or

 <script type="text/coffeescript"> eggs = 'gotta have some' document.write "It really is CoffeeScript: #{eggs}" </script> 

Demo: http://jsfiddle.net/ambiguous/DmuHh/

+8
source

Source: https://habr.com/ru/post/1402385/


All Articles