{"id":18048522,"url":"https://github.com/bent10/posthtml-bootstrap","last_synced_at":"2026-01-24T18:03:28.196Z","repository":{"id":231781032,"uuid":"782715138","full_name":"bent10/posthtml-bootstrap","owner":"bent10","description":"A PostHTML plugin that allows you to use Bootstrap components directly in your HTML code.","archived":false,"fork":false,"pushed_at":"2026-01-19T16:15:54.000Z","size":231,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-19T22:43:39.492Z","etag":null,"topics":["bootstrap","posthtml","posthtml-component","template","ui","x-tag"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/posthtml-bootstrap","language":"TypeScript","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/bent10.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-05T21:41:18.000Z","updated_at":"2025-12-22T01:10:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"7544889d-8aec-4f64-92c5-b7b68297babb","html_url":"https://github.com/bent10/posthtml-bootstrap","commit_stats":null,"previous_names":["bent10/posthtml-bootstrap"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bent10/posthtml-bootstrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Fposthtml-bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Fposthtml-bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Fposthtml-bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Fposthtml-bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bent10","download_url":"https://codeload.github.com/bent10/posthtml-bootstrap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bent10%2Fposthtml-bootstrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28733357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T17:51:25.893Z","status":"ssl_error","status_checked_at":"2026-01-24T17:50:48.377Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bootstrap","posthtml","posthtml-component","template","ui","x-tag"],"created_at":"2024-10-30T20:13:15.381Z","updated_at":"2026-01-24T18:03:28.180Z","avatar_url":"https://github.com/bent10.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# posthtml-bootstrap\n\nA [PostHTML](https://github.com/posthtml/posthtml/) plugin that allows you to use [Bootstrap](https://getbootstrap.com/) components directly in your HTML code.\n\n## Install\n\nTo get started, install the package using npm or yarn:\n\n```bash\nnpm install -D posthtml-bootstrap\n# Or\nyarn add -D posthtml-bootstrap\n```\n\n## Usage\n\n```js\nimport posthtml from 'posthtml'\nimport posthtmlComponent from 'posthtml-component'\nimport { defineBootstrapUIConfig } from 'posthtml-bootstrap'\n\n// Use default configuration\nconst config = defineBootstrapUIConfig()\n// Create a PostHTML processor with the plugin\nconst processor = posthtml([posthtmlComponent(config)])\n\n// Your HTML with Bootstrap components\nconst htmlString = `\n\u003cui:container\u003e\n  \u003cui:row\u003e\n    \u003cui:col\u003e\n      \u003cui:button variant=\"primary\"\u003eClick me!\u003c/ui:button\u003e\n    \u003c/ui:col\u003e\n  \u003c/ui:row\u003e\n\u003c/ui:container\u003e\n`\n\nprocessor\n  .process(htmlString, {\n    recognizeSelfClosing: true\n  })\n  .then(result =\u003e {\n    console.log(result.html) // Processed HTML with Bootstrap components\n  })\n```\n\nA wide range of Bootstrap components are available for use with this plugin. You can find the complete list of components in the [`ui`](https://github.com/bent10/posthtml-bootstrap/tree/main/public/ui) directory.\n\n\u003e **Note:** Detailed documentation for each component is currently under development 😉\n\n## Configuration Options\n\nTo configure Bootstrap UI, use the following JavaScript snippet:\n\n```js\nimport { defineBootstrapUIConfig } from 'posthtml-bootstrap'\n\nconst config = defineBootstrapUIConfig({\n  // Options go here\n})\n```\n\nPlease refer to the [`posthtml-component`](https://posthtml.github.io/posthtml-components/docs.html#options) documentation to review the available options.\n\n### Opinionated options:\n\nThe following options are opinionated and cannot be changed:\n\n- **root**: (string) String value as the root path for component lookup. Always `process.cwd()`.\n- **tagPrefix**: (string) The prefix used for component tags in your HTML. Always `ui:`.\n- **yield**: (string) The tag name used for the main content area within a component. Always `\u003cchildren /\u003e`.\n- **attribute**: (string) The attribute used to specify the component path within a tag. Always `@src`.\n\n## Extended Components\n\n`posthtml-bootstrap` allows you to seamlessly integrate your own custom components alongside the built-in Bootstrap components. This is achieved by referencing the folder path containing your custom components in the `folders` property of the configuration.\n\n1. **Create your custom components:**\n\n   Start by creating your custom components as HTML files within a dedicated folder. For example, let's create a `components` folder and add a simple `foo.html` component:\n\n   ```html\n   \u003c!-- views/components/foo.html --\u003e\n   \u003cdiv class=\"foo\"\u003eThis is a custom foo component.\u003c/div\u003e\n   ```\n\n2. **Configure the plugin:**\n\n   In your JavaScript file, modify the configuration to include the path to your custom components folder:\n\n   ```js\n   import { defineBootstrapUIConfig } from 'posthtml-bootstrap'\n\n   const config = defineBootstrapUIConfig({\n     folders: ['views/components'] // Add your custom components folder\n   })\n   ```\n\n3. **Use your custom components:**\n\n   Now you can use your custom component in your HTML just like any other Bootstrap component:\n\n   ```html\n   \u003cui:container\u003e\n     \u003cui:row\u003e\n       \u003cui:col\u003e\n         \u003cui:foo /\u003e\n       \u003c/ui:col\u003e\n     \u003c/ui:row\u003e\n   \u003c/ui:container\u003e\n   ```\n\n## Custom Utilities\n\nThe `utilities` option allows you to provide custom functions that can be accessed within the `\u003cscript props\u003e` block of a component.\n\n```js\nconst config = defineBootstrapUIConfig({\n  utilities: {\n    formatPrice(price) {\n      return new Intl.NumberFormat('en-US', {\n        style: 'currency',\n        currency: 'USD'\n      }).format(+price)\n    }\n  }\n})\n```\n\nThen, use your custom utility function within a component's props script:\n\n```html\n\u003c!-- views/components/foo.html --\u003e\n\u003cscript props\u003e\n  const { price } = props\n\n  module.exports = {\n    formattedPrice: formatPrice(price)\n  }\n\u003c/script\u003e\n\n\u003c!-- use the formatted price in your component's HTML --\u003e\n\u003cp class=\"foo\"\u003eThe price is: {{formattedPrice}}\u003c/p\u003e\n```\n\nFinally, use the `ui:foo` component like so:\n\n```html\n\u003cui:foo price=\"1000\" /\u003e\n```\n\nThis will render the formatted price using your custom `formatPrice` function:\n\n```html\n\u003cp class=\"foo\"\u003eThe price is: $1,000.00\u003c/p\u003e\n```\n\n## Contributing\n\nWe 💛\u0026nbsp; issues.\n\nWhen committing, please conform to [the semantic-release commit standards](https://www.conventionalcommits.org/). Please install `commitizen` and the adapter globally, if you have not already.\n\n```bash\nnpm i -g commitizen cz-conventional-changelog\n```\n\nNow you can use `git cz` or just `cz` instead of `git commit` when committing. You can also use `git-cz`, which is an alias for `cz`.\n\n```bash\ngit add . \u0026\u0026 git cz\n```\n\n## License\n\n![GitHub](https://img.shields.io/github/license/bent10/posthtml-bootstrap)\n\nA project by [Stilearning](https://stilearning.com) \u0026copy; 2024.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbent10%2Fposthtml-bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbent10%2Fposthtml-bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbent10%2Fposthtml-bootstrap/lists"}