{"id":32486322,"url":"https://github.com/fefeding/vite-nunjucks-plugin","last_synced_at":"2026-01-20T16:49:37.952Z","repository":{"id":314609094,"uuid":"1054672366","full_name":"fefeding/vite-nunjucks-plugin","owner":"fefeding","description":"vite构建时处理nunjucks模板指定的变量和include文件","archived":false,"fork":false,"pushed_at":"2025-09-11T08:07:54.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-16T07:32:26.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/fefeding.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-11T07:08:18.000Z","updated_at":"2025-09-11T08:07:57.000Z","dependencies_parsed_at":"2025-09-13T15:57:38.951Z","dependency_job_id":"bfb5af6c-0f67-4134-9a64-d5700a614965","html_url":"https://github.com/fefeding/vite-nunjucks-plugin","commit_stats":null,"previous_names":["fefeding/vite-nunjucks-plugin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fefeding/vite-nunjucks-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Fvite-nunjucks-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Fvite-nunjucks-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Fvite-nunjucks-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Fvite-nunjucks-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fefeding","download_url":"https://codeload.github.com/fefeding/vite-nunjucks-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fefeding%2Fvite-nunjucks-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281222745,"owners_count":26464003,"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":"2025-10-27T02:00:05.855Z","response_time":61,"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":[],"created_at":"2025-10-27T05:49:45.305Z","updated_at":"2025-10-27T05:49:48.222Z","avatar_url":"https://github.com/fefeding.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@fefeding/vite-nunjucks-plugin`\n\n🔧 一个专为 Vite 设计的 **轻量级 Nunjucks 模板插件**，支持核心语法：**变量替换**、**条件判断**和**模板包含**，未传入的变量会保持原样不报错。\n\n---\n\n## 核心功能\n🔹 **变量替换**：仅替换 `variables` 中定义的变量，其余保持不变  \n🔹 **条件判断**：支持 `{% if %}...{% endif %}` 逻辑控制  \n🔹 **模板包含**：支持 `{% include %}` 引入子模板  \n🔹 **安全处理**：未定义变量/属性保留原模板内容  \n\n---\n\n## 安装\n```bash\nnpm install @fefeding/vite-nunjucks-plugin --save-dev\n# 或\nyarn add @fefeding/vite-nunjucks-plugin -D\n```\n\n## 示例\n```ts\n// 引入插件\nimport ViteNunjucksPlugin from '@fefeding/vite-nunjucks-plugin';\n```\n\n```ts\ndefineConfig({\n    plugins: [\n        vue() as PluginOption, \n        vueJsx() as PluginOption,\n        // 处理模板\n        ViteNunjucksPlugin({\n            variables: {\n                prefix: '', // 构建时，去掉这种prefix前缀，vite会处理依赖关系\n                viteTarget: '',// 构建之后的不加base\n            }\n        }),\n    ]\n})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffefeding%2Fvite-nunjucks-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffefeding%2Fvite-nunjucks-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffefeding%2Fvite-nunjucks-plugin/lists"}