1.0.2 • Published 8 years ago

catberry-es6 v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

Catberry ES6

Babel browserify transformation for Catberry.

Installation

$ npm install --save catberry-es6

Usage

In your buildfile you need to register the catberry-es6 plugin:

build.js:

var catberry = require('catberry');
var babel = require('catberry-es6');

var cat = catberry.create(config);

babel.register(cat.locator);
cat.build();

Configure

Pass the babel section to the Catberry config as options of Babel.

"babel": {
    // options will be here
}

You can find the list of options by these links:

http://babeljs.io/docs/usage/options/

https://github.com/babel/babelify/blob/master/README.md#options

Server

For ES6 support at the server-side you have following ways:

  1. Require Hook
  2. Babel-node
  3. Precompiled node.js application

You can choose the most comfortable way to integrate ES6 on the server-side.

Server example

The simple example of using Babel Require Hook at the server-side:

server.js:

require('babel/register');

var catberry = require('catberry');
var express = require('express');

var cat = catberry.create(config);
var app = express();

app.use(cat.getMiddleware());

cat.events.on('ready', function log () {
  var logger = cat.locator.resolve('logger');
  logger.info(util.format('Catberry application ready to work'));
});

http.createServer(app).listen(config.port);

Kirill Kaysarov defcuts@mail.ru

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

9 years ago