0.2.4-2-beta • Published 12 years ago

ecoco v0.2.4-2-beta

Weekly downloads
38
License
-
Repository
github
Last release
12 years ago

It is assumed that you are familiar with coco language!

Ecoco (Extended COco COmpiler)

ecoco extends coco compiling features.

CLI

Usage:
	ecoco file [options]
	ecoco   -c [options] file [arguments]

Options:

  --examples                 Show code examples

  --defaults                 Show default command line values

  --help, --usage, -h        Show help

  --version                  Show version

  --compile, -c              Equivalent to `coco -c`

  --bare, -b                 Equivalent to `coco -b`

  --uglify, -u, --compress   Compress output (uses `uglify-js`)

  --binary                   Output filename without `.js` and adds
                             `#!/usr/bin/env node` at the beginning of output
                             file.

  --include FILE             If FILE has `co` extension then AT COMPILE TIME
                             prepend FILE to source file. Otherwise if FILE has
                             `js` extension then AFTER compiling prepend FILE
                             to compiled file.

  --make-readme FILE         Replace `{CLI}` in `README.md.src` with `name
                             --usage` and save it to `README.md`.



Examples:

  ecoco -cbu awesome.co    compiles to awesome.js with `bare` and `uglify`
  ecoco --make-readme      compiles README.md.src into README.md
  ecoco binary.co --what   executes binary.co with `--what` argument

Headers

Adding these at the beggining of your source file will change Ecoco behaviour accordingly:

  • #!b or #!bare like ecoco -b
  • #!u or #!ugly or #!uglify like ecoco -u
  • #!binary like ecoco --binary
  • #!include=filename or #!include=filename.co like ecoco --include

Examples

fn = -> "ok!"

compiles to

(function(){
  var fn;
  fn = function(){
    return "ok!";
  };
}).call(this);

--

#!b

fn = -> "bare!"

compiles to

var fn;
fn = function(){
  return "bare!";
};

--

#!u

fn = -> "uglify!"

compiles to

(function(){var e;e=function(){return"uglify!"}}).call(this)

--

node_bin.co:

#!bin
process.stdout.write "I'm alive!\n"

compiles to node_bin:

#!/usr/bin/env node
(function(){
  process.stdout.write("I'm alive!\n");
}).call(this);

--

example.co:

#!include=include_me.co
im_not_alone = true

include_me.co:

you_are_not_alone = true

ecoco example.co compiles to:

(function(){
  var you_are_not_alone, im_not_alone;
  you_are_not_alone = true;
  im_not_alone = true;
}).call(this);

Install

npm install -g ecoco

or

git clone https://github.com/jan-swiecki/ecoco && cd ecoco && npm install && npm link

or if you want to build

git clone https://github.com/jan-swiecki/ecoco && cd ecoco && npm install && coco ecoco.co ecoco.co && npm link

0.2.4-2-beta

12 years ago

0.2.4-1-beta

12 years ago

0.2.3-4-beta

12 years ago

0.2.3-3-beta

12 years ago

0.2.3-2-beta

12 years ago

0.2.3-1-beta

12 years ago

0.2.2-1-beta

12 years ago

0.2.1

12 years ago

0.1.4

12 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago