coffee-babel

1.0.5 • Public • Published

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');

Readme

Keywords

Package Sidebar

Install

npm i coffee-babel

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

6.18 kB

Total Files

8

Last publish

Collaborators

  • jhessin