Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.
TheGreatPanda edited this page Apr 1, 2015 · 10 revisions

logo

ColaScript is a language that compiles into JavaScript. ColaScript is similar to Dart, CoffeeScript, Python, Go and PHP, with some original ideas. Compiler based on UglifyJS2. You can try ColaScript here (stable) or here (dev). Learn more about ColaScript.

Installation

First of all, make sure you have the latest version of node.js (You may need to restart your computer after this step).

From NPM for use as a command line app:

$ npm install cola-script -g

From NPM for programmatic use:

$ npm install cola-script

From Bower for using in browser:

$ bower install cola-script

From Git:

$ git clone git://github.com/TrigenSoftware/ColaScript.git
$ cd ColaScript
$ npm link .

Usage

Usage is identical to UglifyJS2, except for:

-j, --js, --javascript        Work with JavaScript (by default Cola will
                              expect ColaScript).                    [boolean]
-n, --node                    Enable compilation for node.           [boolean]
-P, --packages                Path to packages.json (packages.json by
                              default).                               [string]
-i, --ignore-main-wrapping    Ignore `main` wrapping.                [boolean]
--browser-cola                Build ColaScript for running Cola in browser.
                                                                     [boolean]

Simple example of usage:

$ cola main.cola -o main.min.js -m -c

In browser

During developing is more comfortable to compile the code directly in your browser, for that add browser-cola.js to your.html code:

<script src="path/to/browser-cola.js"></script>

Now you can run your Cola-Code:

<script type="text/colascript" src="path/to/your.cola"></script

If your.cola depends on other scripts in your.html, it's better to notice browser-cola about it:

<script type="text/colascript" src="angular.min.js"></script>
<script type="text/colascript" src="path/to/your.cola"></script>