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

Changing the output file names is missing in English #10348

Open
gfnool opened this issue Dec 12, 2024 · 6 comments
Open

Changing the output file names is missing in English #10348

gfnool opened this issue Dec 12, 2024 · 6 comments
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. good first issue Good for newcomers help wanted Issues looking for someone to run with them! recipe Best solved by creating a short how-to/example

Comments

@gfnool
Copy link

gfnool commented Dec 12, 2024

📚 Subject area/topic

Configuring Astro

📋 Suggested page

https://docs.astro.build/en/guides/configuring-astro/

📋 General description or bullet points (if proposing new content)

In the Italian version there is a section about "Changing the output file names"
https://docs.astro.build/it/guides/configuring-astro/#cambiare-il-nome-dei-file-di-output
That section is missing in the English version, and I think it's very useful.

🖥️ Reproduction of code samples in StackBlitz

No response

@gfnool gfnool added the add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. label Dec 12, 2024
@delucis
Copy link
Member

delucis commented Dec 12, 2024

This was recently removed (the Italian needs updating to remove it too).

As these are standard Rollup options (assetFileNames, chunkFileNames, and entryFileNames), not unique to Astro, and it’s a fairly advanced use case (most users should not need to configure this), we decided to remove it from this page which is focused on introducing basic concepts around configuring Astro.

If we get feedback that this content was valuable though, we could consider restoring the content in some other place (like a dedicated recipe). In that case, it would be helpful to hear what use cases people have for doing this.

@sarah11918
Copy link
Member

Yes, as Chris said, we determined that the information was definitely not in the correct spot on the new introductory page, and we have a task to consider whether this information is indeed something for Astro to document.

I do think this could make a recipe, in which case we would need someone to construct a proper structure around it. Things like:

  • state a problem to solve/specific goal to accomplish (e.g. change output filenames specifically to these names, no "general theory")
  • write an opinionated step-by-step example that achieves that goal
  • show how to check that implementing it was successful

The original English entry, with the code example, can be found in the old v4 docs. If someone would like to turn this into a recipe, we would happily take a PR!

@sarah11918 sarah11918 added good first issue Good for newcomers help wanted Issues looking for someone to run with them! recipe Best solved by creating a short how-to/example labels Dec 13, 2024
@gfnool
Copy link
Author

gfnool commented Dec 14, 2024

OK, I understand your points.

However, I still think it would be useful to explain why filenames like this appear:
Layout.astro_astro_type_script_index_0_lang.DulELbMk.js
even for something as simple as <script src="../scripts/index.js"></script>.

I’ve noticed that in other Astro builds I’ve seen, this doesn’t happen. As someone new to Astro, it feels unusual and a bit confusing, and I’d like to understand the reasoning behind this behavior and how to resolve it to avoid such strange and lengthy filenames.

Thank you for your kind reply

@delucis
Copy link
Member

delucis commented Dec 14, 2024

it would be useful to explain why filenames like this appear:
Layout.astro_astro_type_script_index_0_lang.DulELbMk.js
even for something as simple as <script src="../scripts/index.js"></script>

Is that when running astro build? That looks like a dev server file name to me.

@gfnool
Copy link
Author

gfnool commented Dec 14, 2024

image

it's in the _astro folder after a npm run build and the astro config contains nearly nothing.
Is it because I'm not using typescript, maybe?

@delucis
Copy link
Member

delucis commented Dec 14, 2024

Ah, yes, looks like this is not so uncommon. For example, the docs site currently loads /_astro/Search.astro_astro_type_script_index_0_lang.ByHJUbA9.js. I misremembered those names being a bit shorter.

The short story is: Astro takes care of bundling and optimizing your <script> tags and these optimised files get some automatic names based on a few factors (I’m not super familiar with all the reasons).

But on the whole it shouldn’t matter too much: everything in the _astro/ directory is managed by Astro, linked to by Astro etc. One advantage for example is the “hash” in the names means these files can be cached by web browsers indefinitely. If ever the script changes, it would have a new hash in the name, forcing a redownload. That’s good for site performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. good first issue Good for newcomers help wanted Issues looking for someone to run with them! recipe Best solved by creating a short how-to/example
Projects
None yet
Development

No branches or pull requests

3 participants