{"id":15989434,"url":"https://github.com/brycerussell/astro-public","last_synced_at":"2025-03-17T23:30:36.370Z","repository":{"id":223991078,"uuid":"762114568","full_name":"BryceRussell/astro-public","owner":"BryceRussell","description":"Add custom \"public\" directories for static assets in Astro","archived":false,"fork":false,"pushed_at":"2024-12-10T00:41:46.000Z","size":1600,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T10:02:44.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/astro-public","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/BryceRussell.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}},"created_at":"2024-02-23T05:37:42.000Z","updated_at":"2025-03-09T22:30:28.000Z","dependencies_parsed_at":"2024-10-27T16:25:25.585Z","dependency_job_id":"5630e6f5-5dbf-40dc-b6db-fa59b452bdc8","html_url":"https://github.com/BryceRussell/astro-public","commit_stats":null,"previous_names":["brycerussell/astro-public"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryceRussell%2Fastro-public","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryceRussell%2Fastro-public/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryceRussell%2Fastro-public/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryceRussell%2Fastro-public/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BryceRussell","download_url":"https://codeload.github.com/BryceRussell/astro-public/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243891898,"owners_count":20364604,"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":[],"created_at":"2024-10-08T04:42:48.320Z","updated_at":"2025-03-17T23:30:33.915Z","avatar_url":"https://github.com/BryceRussell.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `astro-public`\n\n[![npm version](https://img.shields.io/npm/v/astro-public?labelColor=red\u0026color=grey)](https://www.npmjs.com/package/astro-public)\n[![readme](https://img.shields.io/badge/README-blue)](https://github.com/BryceRussell/astro-public/tree/main/package)\n\nAdd custom \"public\" directories for static assets in Astro\n\n### Why?\n\n1. Serve static assets from anywhere, including packages\n2. Have multiple static asset directories instead of only the default public directory\n3. Provide placeholder assets that can be overwritten by assets in Astro's public directory\n\n### [Documentation](https://github.com/BryceRussell/astro-public/tree/main/package)\n\n### Example\n\n#### Use as an Integration\n\n```js\n// astro.config.mjs\nimport { defineConfig } from 'astro/config';\nimport publicDir from 'astro-public';\n\nexport default defineConfig({\n  // Creates a 'public' directory at '/static'\n  integrations: [publicDir('static')],\n});\n```\n\n#### Use Inside an Integration\n\n```ts\n// package/index.ts\nimport type { AstroIntegration } from \"astro\";\nimport { addIntegration } from \"astro-integration-kit\";\nimport publicDir from \"astro-public\";\n\nexport default function myIntegration(): AstroIntegration {\n    return {\n        name: \"my-integration\",\n        hooks: {\n            \"astro:config:setup\": ({\n                updateConfig,\n                config,\n                logger,\n            }) =\u003e {\n\n                // Creates a 'public' directory at '/package/static'\n                addIntegration({\n                    integration: publicDir({\n                      dir: \"static\",\n                      cwd: import.meta.url\n                    }),\n                    updateConfig,\n                    config,\n                    logger,\n                })\n\n            }\n        }\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycerussell%2Fastro-public","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrycerussell%2Fastro-public","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycerussell%2Fastro-public/lists"}