{"id":13775129,"url":"https://github.com/Vanilla-IceCream/rollup-plugin-posthtml-template","last_synced_at":"2025-05-11T07:31:54.961Z","repository":{"id":72719834,"uuid":"84806006","full_name":"Vanilla-IceCream/rollup-plugin-posthtml-template","owner":"Vanilla-IceCream","description":"Seamless integration between Rollup and PostHTML, and rendering template properties.","archived":false,"fork":false,"pushed_at":"2022-02-16T11:48:08.000Z","size":93,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T05:44:10.722Z","etag":null,"topics":["posthtml","rollup","template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Vanilla-IceCream.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-13T09:10:20.000Z","updated_at":"2024-09-09T08:18:18.000Z","dependencies_parsed_at":"2024-01-13T12:52:59.162Z","dependency_job_id":"50b543db-a58a-4fc1-bc7c-84d5a968be49","html_url":"https://github.com/Vanilla-IceCream/rollup-plugin-posthtml-template","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"14aa19cfaa71260b1bc47ecf1d3405fc7702b950"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Frollup-plugin-posthtml-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Frollup-plugin-posthtml-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Frollup-plugin-posthtml-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vanilla-IceCream%2Frollup-plugin-posthtml-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vanilla-IceCream","download_url":"https://codeload.github.com/Vanilla-IceCream/rollup-plugin-posthtml-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253533753,"owners_count":21923512,"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":["posthtml","rollup","template"],"created_at":"2024-08-03T17:01:34.257Z","updated_at":"2025-05-11T07:31:54.663Z","avatar_url":"https://github.com/Vanilla-IceCream.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Templating"],"readme":"# rollup-plugin-posthtml-template [![Build Status](https://travis-ci.org/Vanilla-IceCream/rollup-plugin-posthtml-template.svg?branch=master)](https://travis-ci.org/Vanilla-IceCream/rollup-plugin-posthtml-template) [![Coverage Status](https://coveralls.io/repos/github/Vanilla-IceCream/rollup-plugin-posthtml-template/badge.svg?branch=master)](https://coveralls.io/github/Vanilla-IceCream/rollup-plugin-posthtml-template?branch=master)\n\nSeamless integration between Rollup and PostHTML.\n\n## Install\n\n```bash\n$ npm i rollup-plugin-posthtml-template -D\n# or\n$ yarn add rollup-plugin-posthtml-template -D\n```\n\n## Usage\n\n```js\n// rollup.config.js\nimport { join } from 'path';\nimport posthtml from 'rollup-plugin-posthtml-template';\n\nexport default {\n  entry: join(__dirname, 'main.js'),\n  dest: join(__dirname, 'bundle.js'),\n  format: 'iife',\n  plugins: [\n    posthtml()\n  ]\n};\n```\n\n```html\n\u003c!-- hello.html --\u003e\n\u003cp\u003eHello\u003c/p\u003e\n\u003cp\u003eWorld\u003c/p\u003e\n```\n\n```js\n// main.js\nimport hello from './hello.html';\n\ndocument.querySelector('#ex').innerHTML = hello;\n/*\n  Output:\n    \u003cp\u003eHello\u003c/p\u003e\n    \u003cp\u003eWorld\u003c/p\u003e\n*/\n```\n\n### plugins\n\n```js\n// rollup.config.js\nimport { join } from 'path';\nimport posthtml from 'rollup-plugin-posthtml-template';\nimport include from 'posthtml-include';\n\nexport default {\n  entry: join(__dirname, 'main.js'),\n  dest: join(__dirname, 'bundle.js'),\n  format: 'iife',\n  plugins: [\n    posthtml({\n      plugins: [include()]\n    })\n  ]\n};\n```\n\n```html\n\u003c!-- world.html --\u003e\n\u003cp\u003eWorld\u003c/p\u003e\n```\n\n```html\n\u003c!-- hello.html --\u003e\n\u003cp\u003eHello\u003c/p\u003e\n\u003cinclude src=\"world.html\"\u003e\u003c/include\u003e\n```\n\n```js\n// main.js\nimport hello from './hello.html';\n\ndocument.querySelector('#ex').innerHTML = hello;\n/*\n  Output:\n    \u003cp\u003eHello\u003c/p\u003e\n    \u003cp\u003eWorld\u003c/p\u003e\n*/\n```\n\n### template\n\n```js\n// rollup.config.js\nimport { join } from 'path';\nimport posthtml from 'rollup-plugin-posthtml-template';\n\nexport default {\n  entry: join(__dirname, 'main.js'),\n  dest: join(__dirname, 'bundle.js'),\n  format: 'iife',\n  plugins: [\n    posthtml({\n      template: true\n    })\n  ]\n};\n```\n\n```html\n\u003c!-- hello.html --\u003e\n\u003cp\u003eHello\u003c/p\u003e\n\u003cp\u003e${ _.text }\u003c/p\u003e\n```\n\n```js\n// main.js\nimport hello from './hello.html';\n\ndocument.querySelector('#ex').innerHTML = hello({ text: 'World' });\n/*\n  Output:\n    \u003cp\u003eHello\u003c/p\u003e\n    \u003cp\u003eWorld\u003c/p\u003e\n*/\n```\n\n### parser\n\n```js\n// rollup.config.js\nimport { join } from 'path';\nimport posthtml from 'rollup-plugin-posthtml-template';\nimport sugarml from 'posthtml-sugarml';\n\nexport default {\n  entry: join(__dirname, 'main.js'),\n  dest: join(__dirname, 'bundle.js'),\n  format: 'iife',\n  plugins: [\n    posthtml({\n      parser: sugarml()\n    })\n  ]\n};\n```\n\n```sgr\n// hello.sgr\np Hello\np\n  | World\n```\n\n```js\n// main.js\nimport hello from './hello.sgr';\n\ndocument.querySelector('#ex').innerHTML = hello;\n/*\n  Output:\n    \u003cp\u003eHello\u003c/p\u003e\n    \u003cp\u003eWorld\u003c/p\u003e\n*/\n```\n\n### directives\n\n```js\n// rollup.config.js\nimport { join } from 'path';\nimport posthtml from 'rollup-plugin-posthtml-template';\n\nexport default {\n  entry: join(__dirname, 'main.js'),\n  dest: join(__dirname, 'bundle.js'),\n  format: 'iife',\n  plugins: [\n    posthtml({\n      directives: [{ name: '%', start: '\u003c', end: '\u003e' }]\n    })\n  ]\n};\n```\n\n```html\n\u003c!-- hello.html --\u003e\n\u003cp\u003eHello\u003c/p\u003e\n\u003cp\u003e\u003c%= text %\u003e\u003c/p\u003e\n```\n\n```js\n// main.js\nimport { template } from 'lodash';\n\nimport hello from './hello.html';\n\ndocument.querySelector('#ex').innerHTML = template(hello)({ text: 'World' });\n/*\n  Output:\n    \u003cp\u003eHello\u003c/p\u003e\n    \u003cp\u003eWorld\u003c/p\u003e\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVanilla-IceCream%2Frollup-plugin-posthtml-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVanilla-IceCream%2Frollup-plugin-posthtml-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVanilla-IceCream%2Frollup-plugin-posthtml-template/lists"}