1.0.5 • Published 6 years ago

coffee-babel v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

coffee-babel NPM version Build Status Dependency Status Coverage percentage

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

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago