Questions tagged [coffeescript]

A language that transpiles to JavaScript. Use this tag for questions about programming with the CoffeeScript language.

From the CoffeeScript Homepage:

CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.

CoffeeScript can be used in any JavaScript environment. Included in a web page, it supports <script type="text/coffeescript"> tags; with node.js it can compile code on the command line, and it is also available as a Ruby gem.

The documentation and downloads can be found on the CoffeeScript website.

Common causes of unexpected behavior

  • Check your whitespace. Indentation is SIGNIFICANT. Mixing SPACE and TAB in indentation will create problems. Make sure you understand the rules for whitespace and make sure you triple-check this.

Popular questions

###Freely available CoffeeScript programming books

Video Tutorial

Codeschool CoffeeScript Tutorial - Awesome place to start with CoffeeScript.

9747 questions
3
votes
1 answer

Convert image data to render an image in the browser

I am trying to download an encrypted image file from Amazon S3 through a presigned_link with AJAX, and is getting a bunch of image data gibberish. $(document).on 'click', '.js-download', (event) -> event.preventDefault() $.ajax type: "GET" …
Andy Kwong
  • 197
  • 8
3
votes
1 answer

How do I output a block text in coffeescript with spaces BEFORE everything

redditFunny = """ TEST TEST """ console.log redditFunny compiles into var redditFunny; redditFunny = "TEST TEST"; console.log(redditFunny); I just want to output it as is
Jason
  • 71
  • 5
3
votes
1 answer

Gulp and FTP : How to transfer only the content of a folder?

Gulp with vinyl ftp : how to specify different directory name? I am using vinyl-ftp with gulp to push my local dist/ directory to remote production server. Thing is my local ready-to-production directory name is "dist", and I want all of its content…
lapin
  • 2,098
  • 2
  • 21
  • 30
3
votes
1 answer

Increment for loop pointer in CoffeeScript

for char, index in 'some string' if condition index += 2 I have a for loop, where I'm looping over a string and when certain condition is met, I want to skip some number of characters after the current one. In JavaScript, I would do…
someName
  • 33
  • 3
3
votes
1 answer

Coffeescript implicit returns impact on performance and side effects

I am currently working on a node.js web service which utilizes Express.js and Mongoose. Recently, I figured I would try my hand at CoffeeScript, as I have heard that there are some benefits to be had. However, I have noticed something a little…
3
votes
1 answer

brunch: Cannot find module "initialize" from "/"

I am desparating with brunch/node.js. I have a project with a few simple pages, using brunch, backbone.js, jade, and coffeescript. app/assets/index.html has the following scripts included: