{"id":21245280,"url":"https://github.com/jstransformers/consolidate-jstransformer","last_synced_at":"2025-07-10T22:31:03.173Z","repository":{"id":34278719,"uuid":"38166572","full_name":"jstransformers/consolidate-jstransformer","owner":"jstransformers","description":"Consolidate-compatible API for JSTransformers.","archived":false,"fork":false,"pushed_at":"2020-04-26T02:40:35.000Z","size":70,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-13T04:04:23.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://npm.im/consolidate-jstransformer","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/jstransformers.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-27T16:20:25.000Z","updated_at":"2020-04-26T02:39:49.000Z","dependencies_parsed_at":"2022-09-11T05:01:52.504Z","dependency_job_id":null,"html_url":"https://github.com/jstransformers/consolidate-jstransformer","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstransformers%2Fconsolidate-jstransformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstransformers%2Fconsolidate-jstransformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstransformers%2Fconsolidate-jstransformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstransformers%2Fconsolidate-jstransformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jstransformers","download_url":"https://codeload.github.com/jstransformers/consolidate-jstransformer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225658516,"owners_count":17503663,"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-11-21T01:49:44.017Z","updated_at":"2024-11-21T01:49:44.551Z","avatar_url":"https://github.com/jstransformers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# consolidate-jstransformer\n\n[Consolidate](https://github.com/tj/consolidate.js)-compatible API to use [JSTransformers](http://github.com/jstransformers).\n\n[![Build Status](https://img.shields.io/travis/jstransformers/consolidate-jstransformer/master.svg)](https://travis-ci.org/jstransformers/consolidate-jstransformer)\n[![Coverage Status](https://img.shields.io/codecov/c/github/jstransformers/consolidate-jstransformer/master.svg)](https://codecov.io/gh/jstransformers/consolidate-jstransformer)\n[![Dependency Status](https://img.shields.io/david/jstransformers/consolidate-jstransformer/master.svg)](http://david-dm.org/jstransformers/consolidate-jstransformer)\n[![NPM version](https://img.shields.io/npm/v/consolidate-jstransformer.svg)](https://www.npmjs.org/package/consolidate-jstransformer)\n\n## API\n\nReplace the `consolidate` package with `consolidate-jstransformer`.\n\n### Before\n\n``` javascript\nvar cons = require('consolidate')\n```\n\n### After\n\n``` javascript\nvar cons = require('consolidate-jstransformer')\n```\n\n### Usage\n\nUse `consolidate-jstransformer` the same way you would use Consolidate:\n\n```js\nvar cons = require('consolidate-jstransformer');\ncons.swig('views/page.html', { user: 'tobi' }, function(err, html){\n  if (err) throw err;\n  console.log(html);\n});\n```\n\n  Or without options / local variables:\n\n```js\nvar cons = require('consolidate-jstransformer');\ncons.swig('views/page.html', function(err, html){\n  if (err) throw err;\n  console.log(html);\n});\n```\n\n  To dynamically pass the engine, simply use the subscript operator and a variable:\n\n```js\nvar cons = require('consolidate-jstransformer')\n  , name = 'swig';\n\ncons[name]('views/page.html', { user: 'tobi' }, function(err, html){\n  if (err) throw err;\n  console.log(html);\n});\n```\n\n  Render strings rather than files:\n\n```js\nvar cons = require('consolidate-jstransformer')\n  , name = 'swig';\n\ncons[name].render('Hello {{ user }}', { user: 'tobi' }, function(err, html){\n  if (err) throw err;\n  console.log(html);\n});\n```\n\n### Promises\n\nIf no callback function is provided, a Promise will be returned.\n\n```js\nvar cons = require('consolidate-jstransformer');\n\ncons.swig('views/page.html', { user: 'tobi' })\n  .then(function (html) {\n    console.log(html);\n  })\n  .catch(function (err) {\n    throw err;\n  });\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjstransformers%2Fconsolidate-jstransformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjstransformers%2Fconsolidate-jstransformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjstransformers%2Fconsolidate-jstransformer/lists"}