{"id":18434724,"url":"https://github.com/assemble/assemble-layouts","last_synced_at":"2025-04-07T19:31:55.771Z","repository":{"id":18134821,"uuid":"21215900","full_name":"assemble/assemble-layouts","owner":"assemble","description":"Layouts for your templates","archived":false,"fork":false,"pushed_at":"2014-07-24T04:37:07.000Z","size":220,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T00:05:19.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/assemble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-25T19:35:02.000Z","updated_at":"2015-11-21T00:52:35.000Z","dependencies_parsed_at":"2022-09-26T21:41:14.506Z","dependency_job_id":null,"html_url":"https://github.com/assemble/assemble-layouts","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-layouts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-layouts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-layouts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assemble%2Fassemble-layouts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assemble","download_url":"https://codeload.github.com/assemble/assemble-layouts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247716359,"owners_count":20984226,"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-06T06:05:05.935Z","updated_at":"2025-04-07T19:31:55.409Z","avatar_url":"https://github.com/assemble.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# assemble-layouts [![NPM version](https://badge.fury.io/js/assemble-layouts.png)](http://badge.fury.io/js/assemble-layouts)\n\n\u003e Assemble plugin for rendering nested template layouts.\n\n## Install\nInstall with [npm](npmjs.org):\n\n```bash\nnpm i assemble-layouts --save-dev\n```\n\n## API\n### Layouts\n\nCreate a new instance of `Layouts` to generate flattened layout stacks.\n\n**Example:**\n\n```js\nvar layouts = new Layouts(options);\n```\n\nDefault settings for body regex/delimiters:\n\n```js\nvar options = {\n  delims: ['{{', '}}'],     // start and end delimiters for body tag\n  expression: '{{ body }}', // default body tag for empty layouts\n  matter: '\\\\s*body\\\\s*',   // inner contents of body tag regex\n};\n```\n\nAssuming `parsedLayouts` have been read from the file system and parsed, we can now add them to the `layouts` cache:\n\n```js\nvar parsedLayouts = glob.sync('layouts/*.hbs');\nparsedLayouts.forEach(function (layout) {\n  // `layout` must have at `data` and `content` properties\n  layouts.set(layout.name, layout);\n});\n```\n\n### Render the stack\n\nRender the entire layout stack for a specific page object:\n\n```js\nvar page = {data: {a: 'b', layout: 'default'}, content: 'Howdy {{name}}!'};\nvar template = layouts.render(page);\n```\n\n#### page object\n\nThe `page` object must have `data` and `content` properties!\n\n* `options` {Object}: global options for how to determine layouts.   \n\n\n### .flatten\n\nFlatten the entire layout stack based on the `file` and `options`\nand how the layout stack is defined.\n\n* `file` {Object}: object containing `data` and `contents` properties. \n* `options` {Object}: additional options to override `global` and/or `file` options   \n\n\n### .set\n\nStore a layout.\n\n* `name` {String}: name of the layout to store. \n* `layout` {Object}: object containing `data` and `content` properties.   \n\n\n### .get\n\nReturn a stored layout.\n\n* `name` {String}: name of the layout   \n\n\n### .createStack\n\nCreate a layout stack based on options and layout data. Returned stack is\nan array with the layouts to use going from the top level parent to the\nlowest level child.\n\n* `options` {Object}: used to determine the layout to use.   \n\n\n### .useLayout\n\nReturn a valid layout name if one should be used, otherwise, returns `null`\nto indicate a layout should not be used.\n\n* `layout` {String}: layout to use, or a negative value to not use a layout\n\n## Authors\n \n**Brian Woodward**\n \n+ [github/doowb](https://github.com/doowb)\n+ [twitter/doowb](http://twitter.com/doowb) \n \n**Jon Schlinkert**\n \n+ [github/jonschlinkert](https://github.com/jonschlinkert)\n+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) \n\n\n## License\nCopyright (c) 2014 Brian Woodward, contributors.  \nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 24, 2014._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemble%2Fassemble-layouts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassemble%2Fassemble-layouts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassemble%2Fassemble-layouts/lists"}