jahaziel17 / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

Support Literate CoffeeScript #922

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Besides being used as an ordinary programming language, CoffeeScript may also 
be written in "literate" mode. If you name your file with a .litcoffee (or 
.coffee.md) extension, you can write it as a Markdown document — a document 
that also happens to be executable CoffeeScript code. The compiler will treat 
any indented blocks (Markdown's way of indicating source code) as code, and 
ignore the rest as comments. 

It would be nice if we can integrate this into wro4j as well.

Could be "litCoffeeScript" instead of "coffeeScript" for the processor 
definition (ideally with autodetection based on file-extension where 
applicable).

I am not sure if this can be passed as an option to the upstream CoffeeScript 
compiler JS, or if the Markdown stripping has to happen in a pre-processor step 
on our end.

Original issue reported on code.google.com by thilopl...@googlemail.com on 5 Mar 2015 at 1:20

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 5 Mar 2015 at 9:40

GoogleCodeExporter commented 8 years ago
Could you provide any useful references to the literate coffeeScript?

Original comment by alex.obj...@gmail.com on 5 Mar 2015 at 9:41

GoogleCodeExporter commented 8 years ago
There is the section in the CoffeeScript documentation:
http://coffeescript.org/#literate

It points to a blog post for more details, but I cannot seem to open that.
Here's another one: 
http://www.coffeescriptlove.com/2013/02/literate-coffeescript.html

Original comment by thilopl...@googlemail.com on 5 Mar 2015 at 10:44

GoogleCodeExporter commented 8 years ago
> I am not sure if this can be passed as an option to the upstream CoffeeScript 
compiler

If we are using coffee-script.js (the main module of CoffeeScript), which I 
assume we are, there is indeed an option to pass {literate: true} to the 
compile function.

http://coffeescript.org/documentation/docs/coffee-script.html#section-5

(That page, by the way, is a great example of what can be done with Literate 
CoffeeScript, it is automatically generated from the source file.)

Original comment by thilopl...@googlemail.com on 6 Mar 2015 at 10:20