lunaru / CoffeeGrinder

CoffeeScript Compiler Wrapper for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coffee Grinder

CoffeeGrinder is a PHP compiler wrapper for CoffeeScript compilers. It’s useful for dynamically compiling CoffeeScript on the server-side before serving to a client (as opposed to manually compiling scripts).

CoffeeGrinder should be used as part of an existing asset packaging system and is provided for convenience for being part of a larger system. CoffeeGrinder is not an independent CoffeeScript compiler. By default CoffeeGrinder uses jcoffeescript, however, this can be replaced with any compiler that takes CoffeeScript on STDIN and produces compiled code on STDOUT.

Requirements

  • PHP 5.3+
  • Your favorite command line CoffeeScript compiler

Installation

Extract the source files into a directory in your PHP library path. Make sure that you extract the default jcoffeescript JAR to your classpath if you intend to use the default command-line compiler.

Usage

 $coffee = ... // read coffeescript from a file or inline

 $grinder = new CoffeeGrinder();
 echo $grinder->parse($coffee);

You can also use a different command line compiler by passing it in to the constructor of CoffeeGrinder

 $grinder = new CoffeeGrinder('java -jar /my/path/to/jcoffeescript.jar');

About

CoffeeScript Compiler Wrapper for PHP

License:MIT License


Languages

Language:PHP 100.0%