Open
Add per-page asset size analysis with PR comment reporting#40
Conversation
- scripts/analyze-page-sizes.mjs: walks _site HTML pages, extracts local asset references (CSS, JS, images), sums per-page weights, and emits a Markdown report sorted by decreasing total size with a collapsible detailed breakdown. - .github/workflows/page-asset-sizes.yml: PR workflow that builds the Jekyll site, runs the analysis, and posts/updates a PR comment. - dev.sh: adds `page-sizes` command to run the script locally. Closes #39
Copilot
AI
changed the title
[WIP] Add page size analysis in PR builds
Add per-page asset size analysis with PR comment reporting
Jul 26, 2026
srungta
marked this pull request as ready for review
July 26, 2026 17:50
There was a problem hiding this comment.
Pull request overview
Adds automated per-page asset weight reporting for this Jekyll blog, producing a Markdown summary (and per-page breakdown) of built _site page sizes and posting/updating it as a PR comment.
Changes:
- Added
scripts/analyze-page-sizes.mjsto scan built HTML pages, resolve locally referenced assets, and output a Markdown report sorted by total size. - Added a GitHub Actions workflow to build the site on PRs and post/update a single “Page Asset Size Report” comment.
- Extended
dev.shwith apage-sizescommand for local runs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
scripts/analyze-page-sizes.mjs |
New Node script to compute per-page size totals and emit a Markdown report. |
dev.sh |
Adds a page-sizes helper command and completion support. |
.github/workflows/page-asset-sizes.yml |
New workflow to build Jekyll on PRs and post/update the report comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+71
to
+75
| // <link href="..."> — stylesheets and preloads | ||
| for (const m of html.matchAll(/<link\s[^>]*\bhref=["']([^"']+)["'][^>]*>/gi)) { | ||
| const u = cleanUrl(m[1]); | ||
| if (isLocal(u)) urls.add(u); | ||
| } |
Comment on lines
+7
to
+10
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
Comment on lines
+10
to
+11
|
|
||
| jobs: |
Comment on lines
+3
to
+6
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On every PR, post (and update) a comment reporting the total download weight of each page in the built site — HTML + CSS + JS + images — sorted by decreasing size, with a collapsible per-asset breakdown.
New:
scripts/analyze-page-sizes.mjs_site/**/*.html; extracts locally-referenced assets from<link href>,<script src>,<img src>, and<source srcset/src>via regex (no external deps)html,css,js,image,font,other), resolves paths against_site, sums weights per page<details>block with the full per-asset breakdown--site <path>override; exits with a clear message if_siteis missingExample PR comment output:
New:
.github/workflows/page-asset-sizes.ymlpull_request(opened, synchronize, reopened)jekyll 3.9.0+kramdown-parser-gfm 1.1.0(matches Dockerfile), runsjekyll build, then the analysis scriptpeter-evans/find-comment+peter-evans/create-or-update-commentto create-or-replace a single comment per PRUpdated:
dev.sh./dev.sh page-sizes [--site <path>]for local runs afterjekyll build