Convert a CoffeeScript project to JavaScript (without minification)?

62,040

Solution 1

Compiling CoffeeScript into JavaScript usually results in JS that is fairly readable. You can convert snippets on the fly on the "Try CoffeeScript" tab of the CoffeeScript homepage, or via the CoffeeScript command line tool.

There are also tools like decaffeinate that convert CoffeeScript source to modern JavaScript.

If you know JavaScript and just want to be able to read the source of a file, a perusal of the CoffeeScript homepage will probably give you enough understanding of CoffeeScript to read CoffeeScript sources fairly easily.

Solution 2

There's also this online compiler http://js2coffee.org/ that can convert coffeescript to and from javascript

Solution 3

On http://coffeescript.org/ there is a tab - try CoffeeScript

Stick the coffee in the left side and JS pops up on the left

Solution 4

BinaryMuse pointed you to the CoffeeScript command line tool, but I'd thought I post the actual command for posterity:

  • Compile a directory tree of .coffee files in src into a parallel tree of .js files in lib:

    coffee --compile --output lib/ src/

Solution 5

You could also try Depercolator which wraps up a bunch of commands together (includes decafinate, cjsx-transform, react-codemod, prettier).

The writeup: https://blog.bugsnag.com/converting-a-large-react-codebase-from-coffeescript-to-es6/ and GH repo: https://github.com/bugsnag/depercolator

Share:
62,040
blong
Author by

blong

Updated on July 09, 2022

Comments

  • blong
    blong almost 2 years

    We're using a particular jQuery plugin written in CoffeeScript at work and I'm hoping I can convert the project into somewhat normal looking JavaScript. The library looks like it's structured really well (good OOP practices), but I'd really like it if I could explore it's source code without having to learn all the tricks that CoffeeScript entails.