{"id":35474669,"url":"https://github.com/rstackjs/rsbuild-plugin-pug","last_synced_at":"2026-03-14T06:05:49.468Z","repository":{"id":246782801,"uuid":"822451776","full_name":"rstackjs/rsbuild-plugin-pug","owner":"rstackjs","description":"An Rsbuild plugin to provide support for the Pug template engine.","archived":false,"fork":false,"pushed_at":"2026-01-02T08:54:35.000Z","size":197,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-08T07:39:05.843Z","etag":null,"topics":["rsbuild","rsbuild-plugin","rspack"],"latest_commit_sha":null,"homepage":"","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/rstackjs.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-01T07:20:29.000Z","updated_at":"2026-01-02T08:54:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"bb32b1eb-c2e4-44de-8e78-1b01638a5b81","html_url":"https://github.com/rstackjs/rsbuild-plugin-pug","commit_stats":null,"previous_names":["rspack-contrib/rsbuild-plugin-pug","rstackjs/rsbuild-plugin-pug"],"tags_count":7,"template":false,"template_full_name":"rstackjs/rsbuild-plugin-template","purl":"pkg:github/rstackjs/rsbuild-plugin-pug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstackjs%2Frsbuild-plugin-pug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstackjs%2Frsbuild-plugin-pug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstackjs%2Frsbuild-plugin-pug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstackjs%2Frsbuild-plugin-pug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstackjs","download_url":"https://codeload.github.com/rstackjs/rsbuild-plugin-pug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstackjs%2Frsbuild-plugin-pug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28251784,"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","status":"online","status_checked_at":"2026-01-09T02:00:07.210Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["rsbuild","rsbuild-plugin","rspack"],"created_at":"2026-01-03T12:00:40.055Z","updated_at":"2026-01-09T02:01:46.813Z","avatar_url":"https://github.com/rstackjs.png","language":"TypeScript","readme":"# @rsbuild/plugin-pug\n\nAn Rsbuild plugin to provide support for the Pug template engine.\n\n\u003e [Pug](https://github.com/pugjs/pug) is a robust, elegant, feature rich template engine for Node.js.\n\n\u003cp\u003e\n  \u003ca href=\"https://npmjs.com/package/@rsbuild/plugin-pug\"\u003e\n   \u003cimg src=\"https://img.shields.io/npm/v/@rsbuild/plugin-pug?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"npm version\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\u0026colorA=564341\u0026colorB=EDED91\" alt=\"license\" /\u003e\n\u003c/p\u003e\n\n## Usage\n\nInstall:\n\n```bash\nnpm add @rsbuild/plugin-pug -D\n```\n\nAdd plugin to your `rsbuild.config.ts`:\n\n```ts\n// rsbuild.config.ts\nimport { pluginPug } from \"@rsbuild/plugin-pug\";\n\nexport default {\n  plugins: [pluginPug()],\n};\n```\n\n### Using Pug Templates\n\nAfter the plugin registration is completed, Rsbuild will automatically parse template files with the `.pug` extension and compile them using the Pug template engine.\n\nFor example, first create a `src/index.pug` file, and point to that file using `html.template`:\n\n```ts title=\"rsbuild.config.ts\"\nexport default {\n  html: {\n    template: \"./src/index.pug\",\n  },\n};\n```\n\nThen, you can use Pug syntax in the `index.pug` template:\n\n```html\n\u003c!-- Input --\u003e\np Hello #{text}!\n\n\u003c!-- Output --\u003e\n\u003cp\u003eHello World!\u003c/p\u003e\n```\n\nPlease refer to the [Pug documentation](https://github.com/pugjs/pug) for a complete understanding of Pug's usage.\n\n### Using in Vue\n\nWhen using Vue, you can use Pug syntax in the template of `.vue` files:\n\n```vue title=\"App.vue\"\n\u003ctemplate lang=\"pug\"\u003e\nbutton.my-button(@click='count++') Count is: {{ count }}\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { ref } from \"vue\";\n\nexport default {\n  setup() {\n    const count = ref(0);\n\n    return {\n      count,\n    };\n  },\n};\n\u003c/script\u003e\n```\n\n## Options\n\n### pugOptions\n\nUsed to set the compilation options for Pug. For detailed options, please refer to the [Pug API Reference](https://pugjs.org/api/reference.html#options).\n\n- **Type:** `Object | Function | undefined`\n- **Default:**\n\n```ts\nconst defaultOptions = {\n  doctype: \"html\",\n  compileDebug: false,\n};\n```\n\n- **Example 1:** Pass in a configuration object that will be merged with the default options using `Object.assign`.\n\n```ts\npluginPug({\n  pugOptions: {\n    doctype: \"xml\",\n  },\n});\n```\n\n- **Example 2:** Pass in a configuration function. The default configuration will be passed as the first argument, and you can directly modify the configuration object or return a value as the final result.\n\n```ts\npluginPug({\n  pugOptions(config) {\n    config.doctype = \"xml\";\n  },\n});\n```\n\n## License\n\n[MIT](./LICENSE).\n","funding_links":[],"categories":["Plugins"],"sub_categories":["Rsbuild Plugins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstackjs%2Frsbuild-plugin-pug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstackjs%2Frsbuild-plugin-pug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstackjs%2Frsbuild-plugin-pug/lists"}