Mr Coffee
Yes. I always have my coffee when I watch radar, you know that. — Dark Helmet
Mr Coffee provides support for CoffeeScript modules with Mr.
To make use of Mr Coffee, install it in your project. All files bearing
the a name like *.coffee
will be translated on the fly with Mr (no
build step in development) and bundled by Mrs.
npm install mr mr-coffee --save
greeting = document.querySelector '#greeting'
who = greeting.dataset.who
greeting.innerHTML = "Hello, #{who}"
Use mrs
(part of Mr) to build the a bundle, with just the compiled
JavaScript.
./node_modules/.bin/mrs demo/hello.coffee
Produces a bundle, similar to one generated by Browserify. Philosophically,
the difference is that your translators, compilers, and optimizers are
configured in package.json
and used both with Mr (development) and Mrs
(production).
{ // unpack module tuples into module objects for var i = 0; i < moduleslength; i++ modulesi = modulesi0 modulesi1; { thisdependencies = dependencies; thisfactory = factory; } Moduleprototype { var module = this; if !moduleexports moduleexports = {}; var { var index = moduledependenciesid; var dependency = modulesindex; if !dependency throw "Bundle is missing a dependency: " + id; return dependency; } moduleexports = module || moduleexports; return moduleexports; }; return modules0;}{return{}{ // mr-coffee demo/hello.coffee// --------------------------- { var greeting who; greeting = document; who = greetingdatasetwho; greetinginnerHTML = "Hello, " + who; };}}this