{"id":15732758,"url":"https://github.com/jonschlinkert/expand-front-matter","last_synced_at":"2026-03-03T21:32:23.506Z","repository":{"id":65990675,"uuid":"41947428","full_name":"jonschlinkert/expand-front-matter","owner":"jonschlinkert","description":"Middleware for processing config templates in front matter. Can be used with verb, assemble v0.6.0, or any application based on jonschlinkert/template.","archived":false,"fork":false,"pushed_at":"2016-12-26T20:52:22.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-26T18:56:59.849Z","etag":null,"topics":["assemble","expand","front-matter","middleware"],"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/jonschlinkert.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":"2015-09-05T03:23:03.000Z","updated_at":"2021-04-12T22:33:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"f664da2a-6473-45dc-918b-0db10c58bcdf","html_url":"https://github.com/jonschlinkert/expand-front-matter","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"dbbd01bcc8b6528c42c42605327b67d5b08e1563"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexpand-front-matter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexpand-front-matter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexpand-front-matter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexpand-front-matter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/expand-front-matter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243351177,"owners_count":20276894,"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":["assemble","expand","front-matter","middleware"],"created_at":"2024-10-04T00:22:11.595Z","updated_at":"2026-03-03T21:32:23.432Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# expand-front-matter [![NPM version](https://img.shields.io/npm/v/expand-front-matter.svg?style=flat)](https://www.npmjs.com/package/expand-front-matter) [![NPM monthly downloads](https://img.shields.io/npm/dm/expand-front-matter.svg?style=flat)](https://npmjs.org/package/expand-front-matter)  [![NPM total downloads](https://img.shields.io/npm/dt/expand-front-matter.svg?style=flat)](https://npmjs.org/package/expand-front-matter) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/expand-front-matter.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/expand-front-matter)\n\n\u003e Middleware for processing config templates in front matter. Can be used with verb, assemble v0.6.0 and greater, or any application based on jonschlinkert/templates.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save expand-front-matter\n```\n\n## Usage\n\nWorks with [assemble](https://github.com/assemble/assemble), [verb](https://github.com/verbose/verb), [generate](https://github.com/generate/generate), [update](https://github.com/update/update), or any [Template](https://github.com/jonschlinkert/template)-based application. Just replace assemble in the examples with your application of choice.\n\n### Preparation\n\nThis requires front-matter to be parsed in advance. You can easily do this with [parser-front-matter](https://github.com/jonschlinkert/parser-front-matter) like this:\n\n```js\nvar assemble = require('assemble');\nvar app = assemble();\n\n// parse front matter on all `hbs` files\napp.onLoad(/\\.hbs$/, function(view, next) {\n  matter.parse(view, next);\n});\n```\n\n### Middleware usage\n\nUse as a middleware:\n\n```js\nvar expand = require('expand-front-matter');\nvar assemble = require('assemble');\nvar app = assemble();\n\napp.onLoad(/\\.hbs$/, expand(app));\napp.pages('*.hbs');\n```\n\n### Plugin usage\n\n**app plugin**\n\nUse as an \"instance\" plugin on `app` to expand templates in the front-matter of all views in all collections:\n\n```js\nvar expand = require('expand-front-matter');\nvar assemble = require('assemble');\nvar app = assemble();\napp.use(expand());\n\napp.pages('*.hbs');\n```\n\n**Collection plugin**\n\nUse as a collection instance plugin to expand templates in the front-matter of all views in the collection:\n\n```js\nvar expand = require('expand-front-matter');\nvar assemble = require('assemble');\nvar app = assemble();\napp.create('pages')\n  .use(expand(app));\n\napp.pages('*.hbs');\n```\n\n**view plugin**\n\nUse as a view plugin to expand templates in the front-matter of a specific view:\n\n```js\nvar expand = require('expand-front-matter');\nvar assemble = require('assemble');\nvar app = assemble();\napp.create('pages')\n\napp.page('foo', {content: '...'})\n  .use(expand(app))\n  .render(function(err, res) {\n    //=\u003e do stuff to res\n  });\n```\n\n## About\n\n### Related projects\n\n* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble \"Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit\")\n* [expand](https://www.npmjs.com/package/expand): Recursively resolve templates in an object, string or array. | [homepage](https://github.com/jonschlinkert/expand \"Recursively resolve templates in an object, string or array.\")\n* [template](https://www.npmjs.com/package/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template) | [homepage](https://github.com/jonschlinkert/template \"Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.\")\n* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb \"Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](https://github.com/jonschlinkert/expand-front-matter/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on December 26, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fexpand-front-matter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fexpand-front-matter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fexpand-front-matter/lists"}