{"id":15619311,"url":"https://github.com/theseally/vite-plugin-pug-transformer","last_synced_at":"2025-04-24T04:51:56.948Z","repository":{"id":45480523,"uuid":"455970963","full_name":"TheSeally/vite-plugin-pug-transformer","owner":"TheSeally","description":"Vite plugin for supporting pug templates","archived":false,"fork":false,"pushed_at":"2024-12-19T21:50:35.000Z","size":179,"stargazers_count":38,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T04:51:46.316Z","etag":null,"topics":["pug","pug-template-engine","vite"],"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/TheSeally.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}},"created_at":"2022-02-05T19:52:59.000Z","updated_at":"2024-12-19T21:49:58.000Z","dependencies_parsed_at":"2023-11-18T21:28:34.783Z","dependency_job_id":"79dfad50-dbda-4632-9d5e-ef140b51647c","html_url":"https://github.com/TheSeally/vite-plugin-pug-transformer","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":"0.17391304347826086","last_synced_commit":"67c958b8daec1be979979d885e647953271ab06c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSeally%2Fvite-plugin-pug-transformer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSeally%2Fvite-plugin-pug-transformer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSeally%2Fvite-plugin-pug-transformer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSeally%2Fvite-plugin-pug-transformer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheSeally","download_url":"https://codeload.github.com/TheSeally/vite-plugin-pug-transformer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250566446,"owners_count":21451230,"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":["pug","pug-template-engine","vite"],"created_at":"2024-10-03T08:04:58.475Z","updated_at":"2025-04-24T04:51:56.927Z","avatar_url":"https://github.com/TheSeally.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Test](https://github.com/TheSeally/vite-plugin-pug-transformer/actions/workflows/test.yml/badge.svg)](https://github.com/TheSeally/vite-plugin-pug-transformer/actions/workflows/test.yml)\n\n# Vite plugin pug transformer\nThis plugin adds support for pug template engine in vite html entrypoint.\n\nPlugin uses Vite specific hook (`transformIndexHtml`) for transforming pug into html.\n\n## Table of Contents\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Plugin options](#plugin-options)\n- [Example](#example)\n\n\n## Requirements\n- Vite v2+\n- Node.js version depends on Vite version:\n  - Vite v2 requires Node.js v12.22 or higher;\n  - Vite v3, v4 requires Node.js v14.18 or higher;\n  - Vite v5, v6 requires Node.js 18, 20, and 22+;\n\n## Installation\nYou can use any package manager to install plugin:\n\n```\nnpm install vite-plugin-pug-transformer\n\n// OR\nyarn add vite-plugin-pug-transformer\n\n// OR\npnpm install vite-plugin-pug-transformer\n```\n\nThen it can be added to vite config:\n\n```js\n// vite.config.js\nimport vitePugPlugin from 'vite-plugin-pug-transformer';\n\nexport default {\n  plugins: [vitePugPlugin()],\n};\n```\n\n## Usage\nPlugin syntax don't break html semantics.\nIt uses `template` tag with two attributes `data-type` and `data-src`.\nPass `pug` to `data-type` attribute and path to pug template to `data-src` attribute.\n\n```html\n\u003ctemplate data-type=\"pug\" data-src=\"./template.pug\"\u003e\u003c/template\u003e\n\n\u003c!-- OR with self-closed tag --\u003e\n\u003ctemplate data-type=\"pug\" data-src=\"./template.pug\" /\u003e\n```\n\nAlso you can use multiple `template` tags on page\n\n## Plugin options\nPlugin supports additional options\n\n| Parameter  | Default | Description\n| ---------- | ------- | -----------\n| pugOptions | `{}`    | [Pug options](https://pugjs.org/api/reference.html#options)\n| pugLocals  | `{}`    | Variables that can be used in pug template. Can be used to pass env variables\n\n## Example\nVite entrypoint:\n\n```html\n\u003c!-- index.html --\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003ePug Plugin\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003ctemplate data-type=\"pug\" data-src=\"./template.pug\"\u003e\u003c/template\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\nPug template:\n```\n\u003c!-- template.pug --\u003e\np #{bundler} is the best\n```\n\nVite config:\n```js\n// vite.config.js\nimport vitePugPlugin from 'vite-plugin-pug-transformer';\n\nconst locals = { bundler: 'Vite' };\n\nexport default {\n  plugins: [vitePugPlugin({ pugLocals: locals })],\n};\n```\n\nThe result would be:\n```html\n\u003c!-- index.html --\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003ctitle\u003ePug Plugin\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cp\u003eVite is the best\u003c/p\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheseally%2Fvite-plugin-pug-transformer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheseally%2Fvite-plugin-pug-transformer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheseally%2Fvite-plugin-pug-transformer/lists"}