{"id":14967758,"url":"https://github.com/vendethiel/nephrite","last_synced_at":"2025-07-30T03:32:56.401Z","repository":{"id":7507692,"uuid":"8857771","full_name":"vendethiel/nephrite","owner":"vendethiel","description":"Converts JadeCo/JadeLS/JadeCoffee to HTML with interpolations","archived":false,"fork":false,"pushed_at":"2015-05-16T10:47:03.000Z","size":273,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T10:46:04.663Z","etag":null,"topics":["coco","interpolation","jade","makefile","template-engine"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vendethiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-18T15:50:55.000Z","updated_at":"2019-09-16T12:42:50.000Z","dependencies_parsed_at":"2022-09-22T13:13:38.981Z","dependency_job_id":null,"html_url":"https://github.com/vendethiel/nephrite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vendethiel/nephrite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendethiel%2Fnephrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendethiel%2Fnephrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendethiel%2Fnephrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendethiel%2Fnephrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vendethiel","download_url":"https://codeload.github.com/vendethiel/nephrite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vendethiel%2Fnephrite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267803982,"owners_count":24146527,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["coco","interpolation","jade","makefile","template-engine"],"created_at":"2024-09-24T13:38:33.901Z","updated_at":"2025-07-30T03:32:56.363Z","avatar_url":"https://github.com/vendethiel.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":" [![Build Status](https://secure.travis-ci.org/vendethiel/nephrite.png)](http://travis-ci.org/vendethiel/nephrite)\n\nNephrite\n==============\n\nPre-compiles [Jade](https://github.com/visionmedia/jade) to Coffee/Coco/LiveScript, allowing you to have the syntax of Jade with the best perfs (only interpolation is used). It also avoids you the pain of undefined and null by auto-soaking.\n\nTo make you understand this a bit better, let's say that your code :\n\n```jade\nul#pages\n  for page in @pages\n    li: a(href=\"page/#{page}\")= page\n```\n\nwill get compiled to\n\n```js\n'\u003cul id=\"pages\"\u003e' + join((function () {\n  var ref$, results$ = [];\n  for (key in ref$ = locals.pages) {\n    val = ref$[key];\n    results$.push('\u003cli\u003e\u003ca href=\"page/' + page + '\"\u003e' + page + '\u003c/a\u003e\u003c/li\u003e');\n  }\n  return results$;\n}()) || '') + '\u003c/ul\u003e'\n```\n\n**IMPORTANT NOTE** : nephrite does **NOT** do escaping. This is because its main use-case (FULL SPEED) (also the fact that it was hard hard to do considering the code). Use at your own risk ;).\n\nJade itself can be slow due to several factors (`with`, `attrs`, `escape`) and this project allows you to avoid that!\n\n(the code is highly unstable and total crap)\nTho, it's used in [c4](http://github.com/qqueue/c4) and [wowboardhelpers](http://github.com/vendethiel/wowboardhelpers).\n\n\n## Extension\n\nFiles are valid jade files per se, minus the `@` part.\nNephrite's default extension is `.ne` - `.jade` being valid too.\n\n## Usage\n\nCompile it and use it client-side (this acts like jade's `client: true`).\nAttributes are passed as `locals`, aliased to `@`. You can pass an extra attributes object as `@@`.\nThe code returned is a module export (`module.exports = -\u003e ...`).\n\n```coffee\n# compile it\nnephrite = require 'nephrite'\n\nsrc = nephrite 'a(b=\"#{@c}\")', 'index.jade', options\njs = Coco.compile src, {bare: true, filename}\n\n# use it client-side\nfn obj, extra\n```\n\nThe options object is passed to jade, without :\n\n  - the `safe` option, for `@` and `@@` replacement (see below).\n\n\n## Syntax\n\nThe syntax is the same as Jade, with a few gotchas :\n  - Don't prefix your tags with `-`, it's jade interpolation, to allow for even better perfs on static content :\n\n```jade\nul#pages\n - for (var i = 0; i \u003c= 10; ++i)\n    li: a(data-page=i, href=\"/page/%{i}\")== i\n```\n\n  for tags, see just below.\n\n  - Jade output is `==` (as seen just before). This is executed compile-time (by jade).\n\n  - Jade interpolation is `%{}`\n\n  - Tags are automatically recognized.\n    Currently supported tags are : `if`, `unless`, `while`, `for`, `else`.\n    Loops are automatically joined.\n\n  - To avoid complexity in the converter, for attribute interpolation you have to explicitely interpolate them :\n  `a(href=foo) Foo!` will use jade's `foo` local (compile time) whereas\n  `a(href=\"#{@foo}\") Foo!` will use your `@foo` (`locals.foo`, runtime).\n\n  - Filter content is not modified in any way.\n\n  - The \"silent code interpolation\" (and prelude) is `~`.\n    (take note that any code interpolation appearing BEFORE content will be moved in the prelude, out of the closure, for better perfs.)\n    For example :\n\n```jade\n~ template = require 'user-template'\n~ /*^ this will be moved out of the closure function*/\n#users\n  ~ /*this will not*/\n  ~ \"this won't be outputted anyway\"\n```\n\n  - For bigger blocks, use `:prelude` filter.\n\n```coffee\n:prelude\n  gen-classes = -\u003e\n    classes = \"post \"\n    classes += \"abc \" if it.abc\n    classes\n\nblah= gen-classes {}\n```\n  Remember, of course, that you should avoid having too much logic in your templates\n\n  - Do note one thing : replacement of `@` is `@@` is made globally, even in your text.\n    For example, `div @hey` will give `\u003cdiv\u003elocals.hey\u003c/div\u003e`.\n\n    In order to avoid that, you can enable the \"safe mode\" through two ways :\n\n      - Passing the option `{+safe}` to the compiling (3rd parameter).\n\n      - Using the directive in prelude :\n      ```jade\n        ~ \"use safe\"\n        div @hey\n        div= @this-is-interpolated\n      ```\n\n      Be warned that this comes with a performance loss (the function is wrapped with an IIFE for the transpiler to recognize `@` as `this`), which is why it's not active by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendethiel%2Fnephrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvendethiel%2Fnephrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvendethiel%2Fnephrite/lists"}