API

Want to use the compilation API used in the playground?

The API is a very simple POST handler to the URI http://www.learnjade.com/api/compile/.

Send your jade source through POST, with all template names as your hash key. The key "main" is the hard coded entry point to compilation, so it must always be there.

{
    "main": "p Hello, World!"
}

If you want to send multiple templates just add keys.

{
    "main": "p Hello, World!\ninclude widget",
    "widget": "p I am the widget"
}

The response will be a hash with keys "success" (boolean) and "output" (string).

{
    "success": true,
    "output": "<p>Hello, World!</p><p>p I am the widget</p>"
}

The Jade language project is now pug. This site is now obsolete and will be shut down in November 2017. Thank you for visiting this site during all these years. - Glenn