coffee-babel
A simple wrapper around coffeescript/register to allow parameters to be passed to coffeescript.
Last updated 2 years ago by jhessin .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install coffee-babel 
SYNC missed versions from official npm registry.

coffee-babel [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]

This is a node application generated using generator-coffee-node.

This package came about as an attempt to improve on the default coffeescript/register method of importing .coffee files. Currently there is no way to pass options. This wrapper does that for you.

This wouldn't be possible without this post. The primary code is a copy-paste of his code with a few tweaks - many thanks to him.

By default this package uses v2.2.4 of coffeescript. Any modern version of node should use whatever you are using though.

Usage

First install the package using yarn or npm:

yarn add --dev coffee-babel

Then you can require the file before any coffeescript.

require('coffee-babel')({ // This is the default behavior
  transpile: {
    presets: [ 'env' ]
  }
})

module.exports = require('myfile.coffee'); // file is transpiled.

You can even change the behavior of the compiler by calling the required function again.

coffeeConfig = require('coffee-babel');

coffeeConfig() // removes the default config

require('myOldES5File.coffee');

coffeeConfig({
  transpile: {
    presets: [ 'env' ]
  }
})

require('myNewES6File.coffee');

Current Tags

  • 1.0.5                                ...           latest (2 years ago)

6 Versions

  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 5
Last Day 0
Last Week 0
Last Month 7
Dependencies (3)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |