https://github.com/zw963/js2coffee
Convert yours JavaScript to CoffeeScript, vice versa.
https://github.com/zw963/js2coffee
Last synced: 11 months ago
JSON representation
Convert yours JavaScript to CoffeeScript, vice versa.
- Host: GitHub
- URL: https://github.com/zw963/js2coffee
- Owner: zw963
- License: mit
- Created: 2015-09-08T15:15:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-14T15:00:44.000Z (over 10 years ago)
- Last Synced: 2025-06-15T07:04:06.318Z (12 months ago)
- Language: Ruby
- Homepage:
- Size: 332 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# js2coffee [](https://travis-ci.org/zw963/js2coffee) [](http://badge.fury.io/rb/js2coffee)
Convert yours JavaScript to CoffeeScript, vice versa, just for ruby developer.
## Philosophy
* Keep it simple, a command line with no more options.
* Pretty format output with [coderay](https://github.com/rubychan/coderay).
* Watch a directory, convert automaticly when file change.
* SourceMap generation automaticly, for debug with CoffeeScript in Firefox/Chrome.
* With Nodejs, just for Ruby on Rails developer.
## Getting Started
Install via Rubygems
$ gem install js2coffee
## Usage
Run `js2coffee` or `js2coffee` individually. (old command `coff` is not available.)
### Compile script file to STDOUT.
$ coffee2js your_awesome.coffee
You can redirect STDOUT to a new file.
$ coffee2js your_awesome.coffee > you_awesome.js

### Watching one directory
$ coffee2js script_directory
This will create corresponding js(.js) and Source Map(.js.map) in same directory as coffee file live in.
map file will keep hide with leading dot, e.g. `awesome.js` will create `awesome.coffee and .awesome.js.map`

If one directory named `coffee` or named `js` in you project root, will create another directory
automaticly with cloned directory hierarchy, this will make js and coffee file saved seperately.

### Compile script directly
You can run coffee script directly with: `-e` argments or pipe.


## Environment variable
You can setting `JS2COFFEE_EXCLUDE_PATTERN` to specify the pattern to be skipped when watching one directory.
$ export JS2COFFEE_EXCLUDE_PATTERN='one_pattern|another_pattern'
js2coffee will always skip `node_modules` and `bower_components`.
## Support
* MRI 1.9.3+
* Rubinius 2.2+
## Compiler current used:
* [CoffeeScript 1.1.0](http://coffeescript.org), used for convert from CoffeeScript to JavaScript.
* [js2coffee 2.1.0](http://js2.coffee), used for convert JavaScript to CoffeeScript.
## History
More update info, please See [CHANGELOG](https://github.com/zw963/js2coffee/blob/master/CHANGELOG) for details.
## Contributing
* [Bug reports](https://github.com/zw963/js2coffee/issues)
* [Source](https://github.com/zw963/js2coffee)
* Patches:
* Fork on Github.
* Run `gem install --dev js2coffee` or `bundle`.
* Create your feature branch: `git checkout -b my-new-feature`.
* Commit your changes: `git commit -am 'Add some feature'`.
* Push to the branch: `git push origin my-new-feature`.
* Send a pull request :D.
## license
Released under the MIT license, See [LICENSE](https://github.com/zw963/js2coffee/blob/master/LICENSE) for details.