Skip to content

Instantly share code, notes, and snippets.

@rhaseven7h
Last active August 29, 2015 13:58
Show Gist options
  • Save rhaseven7h/9950357 to your computer and use it in GitHub Desktop.
Save rhaseven7h/9950357 to your computer and use it in GitHub Desktop.
How to use Jade and CoffeeScript together in Meteor (with Atmosphere's Jade)

Meteor with Jade & CoffeeScript

You have to use Atmosphere's Jade package, there isn't yet one available directly to Meteor as of this writing (Meteor 0.8.0).

Highlights

  • You have to name your jade files file_name.jade.html, it gets interpreted correctly as jade but gets loaded in the correct order (otherwise you get clueless undefined var errors).
  • You have to use the +template_name syntax in .jade.html files, instead of regular {{> template_name}}.
  • It is preferred to use the #{variable} syntax to {{variable}} syntax in jade files.

Packages

The packages being used, can be installed issuing:

$ meteor add coffeescript
$ npm install -g meteorite
$ mrt add jade

Afterwards you will have to use the mrt command instead of meteor, just remember that.

Reference

Author

Gabriel Medina
rha7.com@gmail.com

if Meteor.isClient
Template.hello.greeting = ->
"Welcome to Gabriel's FirstApp."
Template.hello.saludos = ->
"Test of Second Variable"
Template.hello.events = "click input": ->
console.log "You pressed the button on "+(new Date())
head
title FirstApp
body
+hello
template(name="hello")
h1 Hello World!
p #{greeting}
p #{saludos}
input(type="button" value="Click")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment