{"id":17162023,"url":"https://github.com/aloso/fastjade","last_synced_at":"2026-05-19T14:10:53.218Z","repository":{"id":114068396,"uuid":"104002363","full_name":"Aloso/fastjade","owner":"Aloso","description":"Jade is one of the slowest template engines for node.js. My implementation pre-compiles jade templates and should be a lot faster.","archived":false,"fork":false,"pushed_at":"2017-09-24T17:27:19.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T20:52:21.939Z","etag":null,"topics":["jade","jade-template-engine","template-engine"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aloso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-18T23:31:15.000Z","updated_at":"2017-09-19T02:59:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0f2c029-0e9b-4447-909d-1e6c8c43fc34","html_url":"https://github.com/Aloso/fastjade","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aloso%2Ffastjade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aloso%2Ffastjade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aloso%2Ffastjade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aloso%2Ffastjade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aloso","download_url":"https://codeload.github.com/Aloso/fastjade/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245302374,"owners_count":20593371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jade","jade-template-engine","template-engine"],"created_at":"2024-10-14T22:44:33.887Z","updated_at":"2025-10-11T18:07:31.168Z","avatar_url":"https://github.com/Aloso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastjade\nPug (formerly called jade) is one of the slowest template engines for Node.js. My implementation **pre-compiles** jade templates and should be a lot faster. However, I haven't tested it yet.\n\nFastjade has a \u003ca href=\"http://aloso.bplaced.net/fastjade/\"\u003ehomepage\u003c/a\u003e and a \u003ca href=\"http://aloso.bplaced.net/fastjade/ide.html\"\u003e\u003cb\u003eLIVE DEMO\u003c/b\u003e\u003c/a\u003e!\n\nHere is a simple pug template:\n\n```jade\n// Create variables\n- var title = \"Hello World!\"\n- var injected = true\ndoctype\nhtml\n  head\n    title= title\n    meta(charset=\"utf-8\")\n  body\n    h1!= title\n    p.big A paragraph with a #{injected} value. \n      | More text\n```\n\nPre-compiling it results in a function:\n\n```javascript\nfunction anonymous(context) {\n  with (context || {}) {\n    var _ = \"\";\n    _ += \"\u003c!-- Create variables --\u003e\\n\";\n    var title = \"Hello World!\"\n    var injected = true\n    _ += \"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\u003ctitle\u003e\";\n    _ += (typeof title === 'undefined') ? 'undefined' : escapeHtml(title);\n    _ += \"\u003c/title\u003e\\n\u003cmeta charset=\\\"utf-8\\\"/\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n\u003ch1\u003e\";\n    _ += (typeof title === 'undefined') ? 'undefined' : title;\n    _ += \"\u003c/h1\u003e\\n\u003cp class=\\\"big\\\"\u003e\\nA paragraph with a \";\n    _ += (typeof injected === 'undefined') ? 'undefined' : escapeHtml(injected);\n    _ += \" value. \\nMore text\\n\u003c/p\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\\n\";\n    return _;\n  }\n}\n```\n\nExecuting it results in the following HTML document:\n\n```html\n\u003c!-- Create variables --\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eHello World!\u003c/title\u003e\n    \u003cmeta charset=\"utf-8\"\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch1\u003eHello World!\u003c/h1\u003e\n    \u003cp class=\"big\"\u003eA paragraph with a true value. More text.\u003c/p\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Installation\n\nThis project is not yet available on npm. However, you can install it by copying the 3 files `fastjade.js`, `fastjadec.js` and `time.js` onto your server.\n\nYou only have to include *either* `fastjade.js` *or* `fastjadec.js`. `fastjade.js` can only compile strings, while `fastjadec.js` can compile files and whole directories, too.\n\n```javascript\nvar FastJade = require('./fastjadec.js');\n```\n\nThen you can use it:\n\n```javascript\n// Set the directory where your templates are:\nFastJade.setHomeDirectory('my-templates');\n\n// Pre-compile all files in the templates directory:\nvar stats = FastJade.compileDirectory('/', true);\nconsole.log(\"COMPILED \" + stats.total + \" FILES (\" + stats.duration + \"ms, \" + stats.success + \" successful, \" + stats.failed + \" failed)\");\n\n// Alternatively, do it asynchronously (faster)\nFastJade.compileDirectoryAsync('/', true, function (stats) {\n    console.log(\"COMPILED \" + stats.total + \" FILES (\" + stats.duration + \"ms, \" + stats.success + \" successful, \" + stats.failed + \" failed)\");\n});\n\n// Parse a pre-compiled file. All properties of the second argument\n// can be accessed within the template:\nvar html = FastJade.parse(\"index\", {\n  title: \"Home\"\n});\n\n// Use it in Express.js:\napp.use('/help', function(req, res) {\n  res.send(FastJade.parse(\"help\", {\n    title: \"Help\"\n  }));\n});\n```\n\n## Browser version\n\nFastjade can run in the browser, too:\n\n```html\n\u003c!-- at the end of the body: --\u003e\n\u003cscript type=\"text/javascript\" src=\"fastjade-browser.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    var text = \"doctype\\n\" +\n               \"html\\n\" +\n               \"  head\\n\" +\n               \"    title Hello World!\\n\" +\n               \"  body\\n\" +\n               \"    h1 Hello World!\";\n    var html = FastJade.parse(FastJade.compile(text));\n\u003c/script\u003e\n```\n\n## Known issues\n\n  * `extends`, `block` and `mixin` are not supported yet, but I will add it very soon. Until then, you can use `include`.\n  * Javascript-like constructs (`if/else`, `unless`, `each`, `case`) don't work (yet), but can be realized with actual javascript\n  * In javascript lines, some local variables of the template engine can be accessed. As a result, `_` can't be used as variable name, otherwise the script crashes.\n  * Inline javascript expressions can't span multiple lines\n  * Inline javascript expressions are parsed incorrectly: e.g. `#{ \"}\" }` won't work as the wrong brace is matched\n  * Javascript expressions in HTML are not supported:\n    ```jade\n    //- doesn't work:\n    p(style = {color: \"red\", \"background-color\": \"black\"})\n    \n    //- works:\n    - var darkStyle = {color: \"red\", \"background-color\": \"black\"}\n    p(style = darkStyle)\n    ```\n\n\n## Not supported yet\n\n  * Proper indentation in the output (although this doesn't affect the html document in most cases)\n  * Most filters, like `:coffee-script`, `:babel`, `:uglify-js`, `:less`, and `:markdown-it`\n  * Conditions in attributes: `a(class={active: currentUrl === '/'} href='/') Home`\n  * `\u0026attributes`\n  * Multi-line javascript\n  * When dealing with improper indentation, fastjade behaves differently than pug\n\n## Bugs\n\nThis is a very early release. Please do not use this template engine in production (yet) since there might be bugs. **Please report all bugs you find!** Thanks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faloso%2Ffastjade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faloso%2Ffastjade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faloso%2Ffastjade/lists"}