{"id":24813528,"url":"https://github.com/utsuboco/astro-remove-whitespace","last_synced_at":"2025-08-24T10:23:49.107Z","repository":{"id":270287027,"uuid":"909894021","full_name":"utsuboco/astro-remove-whitespace","owner":"utsuboco","description":"A simple Astro Plugin that removes unnecessary whitespace between HTML tags in your build output.","archived":false,"fork":false,"pushed_at":"2025-02-22T06:26:04.000Z","size":10,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T14:46:36.172Z","etag":null,"topics":[],"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/utsuboco.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}},"created_at":"2024-12-30T02:06:53.000Z","updated_at":"2025-06-11T05:41:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd148673-518d-474f-9805-03633d864298","html_url":"https://github.com/utsuboco/astro-remove-whitespace","commit_stats":null,"previous_names":["utsuboco/astro-remove-whitespace"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/utsuboco/astro-remove-whitespace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utsuboco%2Fastro-remove-whitespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utsuboco%2Fastro-remove-whitespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utsuboco%2Fastro-remove-whitespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utsuboco%2Fastro-remove-whitespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utsuboco","download_url":"https://codeload.github.com/utsuboco/astro-remove-whitespace/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utsuboco%2Fastro-remove-whitespace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271844760,"owners_count":24832818,"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-08-24T02:00:11.135Z","response_time":111,"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-01-30T15:26:12.493Z","updated_at":"2025-08-24T10:23:49.088Z","avatar_url":"https://github.com/utsuboco.png","language":"JavaScript","readme":"# Astro Remove Whitespace Plugin\n\nA simple Astro Plugin that removes unnecessary whitespace between HTML tags in your build output.\n\n## Background\n\nOriginally created by [Utsubo](https://www.utsubo.com), a creative studio based in Japan, to optimize their web projects. \nWe noticed that Astro's build process preserved whitespace between closing tags, which added unnecessary bytes to the final bundle. \nThis plugin solves that issue by cleaning up the HTML output post-build.\n\n## Features\n\n- Removes whitespace between HTML tags in build output\n- Preserves source code readability\n- Runs automatically after build completion\n- Minimal configuration required\n- Maintains other spacing and formatting\n- Processes all HTML files in build directory recursively\n\n## Installation\n\n```bash\nnpm install astro-remove-whitespace\n```\n\n## Usage\n\nAdd the plugin to your `astro.config.mjs`:\n\n```javascript\nimport removeTagWhitespace from 'astro-remove-whitespace';\n\nexport default defineConfig({\n  integrations: [\n    removeTagWhitespace()\n  ],\n});\n```\n\n### Before and After\n\nBefore:\n```html\n\u003c/g\u003e \u003c/g\u003e \u003c/svg\u003e \u003c/div\u003e \u003c/button\u003e\n```\n\nAfter:\n```html\n\u003c/g\u003e\u003c/g\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/button\u003e\n```\n\n## How It Works\n\nThe plugin hooks into Astro's build process using the `astro:build:done` hook. After the build is complete, it:\n\n1. Recursively finds all HTML files in your build directory\n2. Removes whitespace between closing tags using regex\n3. Preserves other formatting and spacing\n4. Writes the optimized content back to the files\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nMIT License - see LICENSE file for details\n\n## Maintainer\n\n[Utsubo](https://www.utsubo.com) - A Technology-First creative studio.\n- [`twitter @utsuboco`](https://twitter.com/utsuboco)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futsuboco%2Fastro-remove-whitespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futsuboco%2Fastro-remove-whitespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futsuboco%2Fastro-remove-whitespace/lists"}