Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

coffeescript to javascript

// --- for Nodejs ---
npm i -g coffeescript
// If you’d like to use Node.js’ CommonJS to require CoffeeScript files, 
// e.g. require './app.coffee', you must first “register” CoffeeScript as an extension
require 'coffeescript/register'

App = require './app' // The .coffee extension is optional

// --- for CLI ---
npm i -D @babel/core @babel/preset-env
// From the root of your project:
echo '{ "presets": ["@babel/env"] }' > .babelrc
coffee -c -t -M some-file.coffee

// read more here https://coffeescript.org/#transpilation
Source by coffeescript.org #
 
PREVIOUS NEXT
Tagged: #coffeescript #javascript
ADD COMMENT
Topic
Name
1+3 =