No description
Find a file
2014-05-20 22:25:44 +02:00
bin Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
example Added generated procedure as example, and link to it from the README. 2014-05-20 22:14:50 +02:00
.gitignore Added generated procedure as example, and link to it from the README. 2014-05-20 22:14:50 +02:00
compiler.js Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
index.js Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
jade-nim.babel Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
jade.nim Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
LICENSE Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
package.json Jade for Nimrod. Requires some npm dependencies because it uses the 2014-05-20 22:00:04 +02:00
README.md Fix README for jade-nim.js 2014-05-20 22:25:44 +02:00

jade-nim

Compiles jade templates to Nimrod functions.

Installation

Clone the repository and put it in your nimrod path (-p:path/to/jade-nim), or use babel to install it.

In your terminal, install the node dependencies:

$ npm install .

Put path/to/jade-nim/bin/ in your PATH variable so that you can launch jade-nim.js from anywhere.

Usage

$ jade-nim.js mytemplate.jade Tmynimrodtype < mytemplate.jade > mytemplate.nim

Tmynimrodtype is a tuple that you have to define in a file named jadeface.nim (which should be accessible in your nimrod path for the compiler to find it). It will be your "interface" between the code you will write and the template renderer.

Example

# jadeface.nim
type
    TList* = tuple
        choice_pills: seq[string]
        is_the_one: bool
# main.nim
import jadeface, list

var list_vars: TList = (choice_pills: @["red", "blue", "silver"],
                        is_the_one: true)
echo list.render(list_vars)
// list.jade
if is_the_one
  p Choose wisely, neo.
else
  p Want some candy?

ul
  for pill in choice_pills
    li #{pill}

See the example Makefile for how to compile.

The Jade template is converted in a purely Nimrod procedure (see example here).

Supported features

Most of Jade features work out-of-the-box, except the following ones:

  • &attributes
  • mixins with dynamic names

Please report any problems or bugs on the issue tracker.