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.
Comment #1
Posted on Mar 5, 2015 by Massive Monkey(No comment was entered for this change.)
Comment #2
Posted on Mar 5, 2015 by Massive MonkeyCould you provide any useful references to the literate coffeeScript?
Comment #3
Posted on Mar 5, 2015 by Happy PandaThere 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
Comment #4
Posted on Mar 6, 2015 by Happy PandaI 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.)
Status: Accepted
Labels:
Type-Task
Priority-Medium