Skip to content

Commit 2bd84a8

Browse files
authored
Remove unused images as part of Astro build process. (#1081)
1 parent 1517308 commit 2bd84a8

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ check:
4343

4444
build:
4545
pnpm build
46-
# NOTE: also let's find a better way to do this :D
47-
find ./dist/_astro/ -iname '*.jpg' -delete
4846

4947
preview: RELEASES_DIR = $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
5048
preview: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)

astro.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import rehypeSlug from "rehype-slug";
1111
import rehypeAutolinkHeadings from "rehype-autolink-headings";
1212
import metaTags from "astro-meta-tags";
1313
import pagefind from "astro-pagefind";
14+
import deleteUnusedImages from "astro-delete-unused-images";
1415

1516
const __filename = fileURLToPath(import.meta.url);
1617
const __dirname = dirname(__filename); // @type-check enabled!
@@ -69,6 +70,7 @@ export default defineConfig({
6970
}),
7071
metaTags(),
7172
pagefind(),
73+
deleteUnusedImages(),
7274
],
7375
output: "static",
7476
build: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@types/react": "^19.0.12",
2323
"@types/react-dom": "^19.0.4",
2424
"astro": "^5.1.6",
25+
"astro-delete-unused-images": "^1.0.3",
2526
"astro-meta-tags": "^0.3.1",
2627
"astro-pagefind": "^1.8.1",
2728
"clsx": "^2.1.1",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)