{"id":16326672,"url":"https://github.com/chrisyip/express-dustjs","last_synced_at":"2025-04-09T14:31:10.443Z","repository":{"id":25845588,"uuid":"29285176","full_name":"chrisyip/express-dustjs","owner":"chrisyip","description":"A Dustjs middleware for Express.","archived":false,"fork":false,"pushed_at":"2021-06-16T11:14:19.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T07:21:30.548Z","etag":null,"topics":[],"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/chrisyip.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}},"created_at":"2015-01-15T07:03:35.000Z","updated_at":"2021-06-16T11:14:22.000Z","dependencies_parsed_at":"2022-08-24T14:14:55.610Z","dependency_job_id":null,"html_url":"https://github.com/chrisyip/express-dustjs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fexpress-dustjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fexpress-dustjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fexpress-dustjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisyip%2Fexpress-dustjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisyip","download_url":"https://codeload.github.com/chrisyip/express-dustjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055081,"owners_count":21040117,"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":[],"created_at":"2024-10-10T23:09:15.453Z","updated_at":"2025-04-09T14:31:10.147Z","avatar_url":"https://github.com/chrisyip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-dustjs\n\nA [Dustjs] middleware for [Express](http://expressjs.com/).\n\n[![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Travis CI][travis-image]][travis-url] [![Coveralls][codecov-image]][codecov-url]\n\n# Installation\n\n```\nnpm install express-dustjs\n```\n\n# Usage\n\n```js\nvar express = require('express')\nvar app = express()\nvar path = require('path')\n\nvar dust = require('express-dustjs')\n\n// Dustjs settings\ndust._.optimizers.format = function (ctx, node) {\n  return node\n}\n\n// Define custom Dustjs helper\ndust._.helpers.demo = function (chk, ctx, bodies, params) {\n  return chk.w('demo')\n}\n\n// Use Dustjs as Express view engine\napp.engine('dust', dust.engine({\n  // Use dustjs-helpers\n  useHelpers: true\n}))\napp.set('view engine', 'dust')\napp.set('views', path.resolve(__dirname, './views'))\n\napp.get('/', function (req, res) {\n  // Render template with locals\n  res.render('index', {\n    title: 'Hello world',\n    name: 'Joe',\n    sentence: 'The quick brown fox jumps over the lazy dog',\n    number: req.query.number || 0\n  })\n})\n```\n\n# API\n\n## `_`\n\nA reference of [Dustjs] instance. You can use it to change Dustjs settings or define helper / filter.\n\n```js\ndust._.helpers.demo = demo\n```\n\n## `bind()`\n\nBy default, `express-dustjs` will use [dustjs-linkedin] (^2.5.1) to render template, if you want to use another version of `dustjs`, do like this:\n\n```js\nvar dust = require('express-dustjs')\ndust.bind(otherDust)\n// Equals to\nvar dust = require('express-dustjs')(otherDust)\n```\n\n## `engine()`\n\nCreate a tempalte engine middleware for Express.\n\n```js\napp.engine('dust', dust.engine({\n  useHelpers: true\n}))\napp.set('view engine', 'dust')\n```\n\nOptions:\n\n- `useHelpers`: if `true`, will load [`dustjs-helpers`] (^1.5.0).\n\n# Compatibility\n\n- Node `\u003e= 0.10`\n- Express `\u003e= 4.10`.\n\n# Contributors\n\nVia [GitHub](https://github.com/chrisyip/express-dustjs/graphs/contributors)\n\n[npm-url]: https://npmjs.org/package/express-dustjs\n[npm-image]: http://img.shields.io/npm/v/express-dustjs.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/chrisyip/express-dustjs\n[daviddm-image]: http://img.shields.io/david/chrisyip/express-dustjs.svg?style=flat-square\n[travis-url]: https://travis-ci.org/chrisyip/express-dustjs\n[travis-image]: http://img.shields.io/travis/chrisyip/express-dustjs.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/chrisyip/express-dustjs\n[codecov-image]: https://img.shields.io/codecov/c/github/chrisyip/express-dustjs.svg?style=flat-square\n[Dustjs]: http://linkedin.github.io/dustjs\n[dustjs-linkedin]: http://linkedin.github.io/dustjs\n[dustjs-helpers]: https://github.com/linkedin/dustjs-helpers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisyip%2Fexpress-dustjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisyip%2Fexpress-dustjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisyip%2Fexpress-dustjs/lists"}