Skip to content

fix: customCSS catch and throw error - #3555

Merged
delucis merged 7 commits into
withastro:mainfrom
Its-Just-Nans:custom-css
Nov 24, 2025
Merged

fix: customCSS catch and throw error#3555
delucis merged 7 commits into
withastro:mainfrom
Its-Just-Nans:custom-css

Conversation

@Its-Just-Nans

Copy link
Copy Markdown
Contributor

Related to #3554

@changeset-bot

changeset-bot Bot commented Nov 15, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a052677

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Nov 15, 2025

Copy link
Copy Markdown

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit a052677
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/6924a69ca3e7330008f817e8
😎 Deploy Preview https://deploy-preview-3555--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the 🌟 core Changes to Starlight’s main package label Nov 15, 2025
@astrobot-houston

Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Starlight! ✨

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🤩

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@Its-Just-Nans Its-Just-Nans changed the title catch and throw fix: custmCSS catch and throw error Nov 16, 2025
@Its-Just-Nans Its-Just-Nans changed the title fix: custmCSS catch and throw error fix: customCSS catch and throw error Nov 16, 2025

@delucis delucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Its-Just-Nans! I actually think we can avoid this code change and instead check it ourselves in the Starlight configuration schema would be my guess. We have access there to the public directory name, so could easily check for values in the customCss array that start with the public directory. That way we avoid hitting the Astro error altogether.

@delucis delucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR @Its-Just-Nans!

I just took the time to update it to run the validation alongside all our other user config validation logic and throw a clear error explaining how to resolve the issue.

@delucis delucis added the 🌟 patch Change that triggers a patch release label Nov 24, 2025
@delucis
delucis merged commit 547dc30 into withastro:main Nov 24, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Nov 24, 2025
@Its-Just-Nans

Copy link
Copy Markdown
Contributor Author

Thanks again for the PR @Its-Just-Nans!

I just took the time to update it to run the validation alongside all our other user config validation logic and throw a clear error explaining how to resolve the issue.

Thanks to you for all your work.

Just a little question, the goal was also to help the user by saying "you can add css using the head configuration of starlight". Why not adding that part?

Thanks you

@delucis

delucis commented Nov 24, 2025

Copy link
Copy Markdown
Member

Why not adding that part?

That’s not the best approach: you really should use src/ and let Starlight bundle CSS for you as it improves the site performance in various ways.

Of course, using head is still possible in the few circumstances where public/ is really needed, but in an error message like this we need to provide clear advice that’s as simple as possible to point users to what is the right choice in most cases so that they can resolve the error quickly.

gxxxr-111 pushed a commit to gxxxr-111/starlight that referenced this pull request Apr 9, 2026
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants