These are separate sublime-build scripts for use in Sublime2. Ensure package AAAPackageDev and BuildSwitcher are installed.
To create a new build script, use one of these two ways:
- Keyboard:
Ctrl+Shift+P(command dialog) then type the following'new bui'+RETURN - Mouse: click on
Tools»Build System»New Build System
From jashkenas tmbundle package, we have the following sublime-build script to compile from .litcoffee to .js but unfortunately, there is no built-in method to convert to .coffee. The (coined) term for this process, by the way, is to 'untangle' a piece of literate computer program source (or prose).
{
"path": "$HOME/bin:/usr/local/bin:$PATH",
"cmd": ["coffee","-c","$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.coffee, source.litcoffee, source.coffee.md"
}To just print output, instead of compile the file, we could use the -p switch on the coffee executable. Note that this also depends on any user settings you may have to compile_on_save and such so your own system behaviour may differ.
{
"cmd": ["coffee", "-p", "$file"],
"selector": ["source.coffee", "source.litcoffee"]
}Finally, support untangle of Literate CoffeeScript we use this as a final part in our two-step (trans)compilation solution; from .litcoffee to .js (step 1) to now .coffee. We have to use the js2coffee package we installed using npm i -g js2coffee. This is now also available as a package if I'm not mistaken.
{
"cmd": ["js2coffee", "$file"],
"selector": "source.js"
}UPDATE: I missed this one: https://github.com/GianlucaGuarini/SublimeText2-Parallel-Builder-Plugin
I have been looking for a 'native' way to 'untangle' the Markdown and CoffeeScript. Earlier I wrote up a quick shell script for this purpose: it uses the tools from NPM repository we already known: coffee-script and js2coffee as terminal applications we can use from the shell, plus 2 or 3 *nix built-in commands like mktemp, cp and cd.
Still, I wanted to be sure that I hadn't missed a flag somewhere so I asked in the IRC #coffeescript channel and the most obvious I had completely forgotten: awk. So the second method demonstrates this concept using the POSIX awk implementation.
You can change the value of the untangle variable to either match literal strings "md" and "cs" (two-way), depending on what you want untangled from the document. Then you can execute from the shell, the following command and arguments:
awk -f ~/patterns/lcs.awk myfile.litcoffeeStep it up a notch, why settle for these when you can also pimp your REPL? Do a quick npm i -g nesh to get system-wide access to improved REPL with history, auto-complete, saved state, help, plugins and auto-coloring of data types and values.
⚠️ Nesh doesn't work with .litcoffee out of the box yet...
{
"cmd": ["nesh", "-c", "$file"],
"selector": "source.js"
}