Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move /assets folder to /_astro #5745

Closed
matthewp opened this issue Jan 4, 2023 · 7 comments · Fixed by #5772
Closed

Move /assets folder to /_astro #5745

matthewp opened this issue Jan 4, 2023 · 7 comments · Fixed by #5772
Assignees
Labels
needs discussion Issue needs to be discussed
Milestone

Comments

@matthewp
Copy link
Contributor

matthewp commented Jan 4, 2023

Move /assets/ to /_astro/

Reasons

  • Avoid route conflicts
  • Sets up a namespace for more endpoints like the Image integration
  • Helps httparchive with fingerprinting

Note, it would be nice if this were more easily configured. For ex.:

export default {
  build: {
    assets: 'my-assets/'
  }
};

This would match what we already have with build.server, build.client, etc.

@matthewp matthewp added this to the 2.0.0 milestone Jan 4, 2023
@matthewp matthewp added the needs discussion Issue needs to be discussed label Jan 4, 2023
@Tc-001
Copy link
Contributor

Tc-001 commented Jan 7, 2023

Would it be useful to have it optionally be outside of dist as well?
On second thought I only see it being useful together with a CDN domain, and that is definitely a future RFC if there isn't one already

@plutoniumm
Copy link

Hey, so this creates a problem with github pages deployment since jekyll does not let you fetch from _ domains on frontend. The problem randomly seems to persist even after adding .nojekyll

It could help to do one of these

  1. Move _astro to some randomly generated hash
  2. Add an adapter for gh-pages where _astro is automatically renamed to something non _

Additionally it might help to add this in the docs too in either FAQ or as a warning

@matthewp
Copy link
Contributor Author

@plutoniumm You can customize this using config.assets. That's what I would suggest doing. A GH integration would be great. But for now you should mention this to the docs team on discord.

@ARISEN-DEV
Copy link

Hey Matthew, i'm pretty noob with Astro but can you please show how can we configure it? Should be awesome if you can do that :D

@plutoniumm
Copy link

Hey Arisen you can go to the astro.config.mjs file, add a root level key to it called build in the defineConfig object, then add a sub key-value pair `assets: 'yourDirName',

You can also check this out from the docs

@leoplaw
Copy link

leoplaw commented Oct 13, 2023

Since there is a problem with github pages deployment since jekyll does not let you fetch from _ domains on frontend, what config option is there to change the _pagefind directory?

@gibbok
Copy link

gibbok commented Jan 18, 2024

@plutoniumm I had the same issue and I was able to solve it. Thansk to your comment!
Would be great have this mentioned in the official docs.
Thanks again

https://github.com/gibbok/typescript-book/blob/main/website/astro.config.mjs#L9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion Issue needs to be discussed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants