Repository navigation
[Docs] Added an "Aliases" page under Guides. [En] - #1042
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). astro-docs – ./docs🔍 Inspect: https://vercel.com/pikapkg/astro-docs/CfiHdaSPqPidKXHBNC9RGiKvmVjj astro-www – ./www🔍 Inspect: https://vercel.com/pikapkg/astro-www/EUjC2gyeePmYP5sUWkxdUkE92Foc |
|
Co-authored-by: Peter Singh <[email protected]>
aFuzzyBear
left a comment
There was a problem hiding this comment.
Hey man, good stuff, I do think that this information is warranted and valuable for those wanting to apply it in astro. I dont however feel that it merits itself as a guide, where as the information presented can help augment the config api page. I feel it would be better placed alongside that body of content.
|
|
||
| ## Adding a custom alias | ||
|
|
||
| If you navigate to the root directory of your project and open the `snowpack.config.mjs` file you will notice that there are some pre-defined aliases already. |
There was a problem hiding this comment.
To add custom aliases to your project, located in the root of your project is the snowpack.config.mjs file. This configuration file contains the instructions for Astro's build tool, Snowpack, on how to build out your Astro project. Inside the file you will notice that there are already some predefined aliases.
There was a problem hiding this comment.
note that some projects don't have this file! mention to create one if you don't have it yet.
| title: Aliases | ||
| --- | ||
|
|
||
| Aliasing is an integral part when it comes to clean and readable code, that's why Astro comes with support for custom aliases out of the box. |
There was a problem hiding this comment.
| Aliasing is an integral part when it comes to clean and readable code, that's why Astro comes with support for custom aliases out of the box. | |
| Aliasing is an integral part when it comes to clean and readable code. Astro comes with support for custom aliases out of the box. Allowing you to maintain a clean and organised project. |
There was a problem hiding this comment.
Actually, I'd remove the first line entirely as too opinionated :) Some people think that aliases are Bad™️, and our project doesn't really take a stance one way or the other.
Instead, maybe use the first sentence to explain what an alias is and why you might want to use it.
Love that you make the point early that Astro supports aliases "out of the box".
| { text: 'Data Fetching', link: 'guides/data-fetching' }, | ||
| { text: 'Markdown', link: 'guides/markdown-content' }, | ||
| { text: 'Supported Imports', link: 'guides/imports' }, | ||
| { text: 'Aliases', link: 'guides/aliases' }, |
There was a problem hiding this comment.
I dont think this should be its own page, having reviewed it I believe this is a better fit to help as an appendix to the references/configuration-reference file, places under the content that is already there.
There was a problem hiding this comment.
We'd pretty much be copy/pasting it from the Snowpack documentation and there's already a link for the whole thing there. If we add this we might as well add everything regarding snowpack.config, that wouldn't be very nice because in my opinion Astro and Snowpack are advertised as two separate things.
There was a problem hiding this comment.
Given how common this question is I kind of like it as a top-level page, at least for now. +1 for keeping as-is for now (top-level page), and we can do a big docs review before a v1 release and move around if needed then.
FredKSchott
left a comment
There was a problem hiding this comment.
Looking good! Adding some comments but overall +1 on getting this merged. Thanks for tackling!
| { text: 'Data Fetching', link: 'guides/data-fetching' }, | ||
| { text: 'Markdown', link: 'guides/markdown-content' }, | ||
| { text: 'Supported Imports', link: 'guides/imports' }, | ||
| { text: 'Aliases', link: 'guides/aliases' }, |
There was a problem hiding this comment.
Given how common this question is I kind of like it as a top-level page, at least for now. +1 for keeping as-is for now (top-level page), and we can do a big docs review before a v1 release and move around if needed then.
| title: Aliases | ||
| --- | ||
|
|
||
| Aliasing is an integral part when it comes to clean and readable code, that's why Astro comes with support for custom aliases out of the box. |
There was a problem hiding this comment.
Actually, I'd remove the first line entirely as too opinionated :) Some people think that aliases are Bad™️, and our project doesn't really take a stance one way or the other.
Instead, maybe use the first sentence to explain what an alias is and why you might want to use it.
Love that you make the point early that Astro supports aliases "out of the box".
|
|
||
| ## What are aliases? | ||
|
|
||
| Aliases are _keywords_ you can use instead of paths. |
There was a problem hiding this comment.
consider removing this header, since the start of every page gets an automatic "Overview" header which these two lines feel like they could fall under.
|
|
||
| ## Adding a custom alias | ||
|
|
||
| If you navigate to the root directory of your project and open the `snowpack.config.mjs` file you will notice that there are some pre-defined aliases already. |
There was a problem hiding this comment.
note that some projects don't have this file! mention to create one if you don't have it yet.
| ```ts | ||
| // snowpack.config.mjs | ||
|
|
||
| alias: { |
There was a problem hiding this comment.
since some people copy-paste these directly, I'd use the full file format (at least for the first example):
// snowpack.config.mjs
export default {
FredKSchott
left a comment
There was a problem hiding this comment.
LGTM with two comments! If you're okay to accept those, then I think this is ready to merge
Co-authored-by: Fred K. Schott <[email protected]>
|
LGTM! |
|
fyi I took another pass on the docs and made some additional edits: 73020fa |
Addressed issue #893.
Changes
Added a page that explains what aliases are, how to define them and how to use them in a project.
Testing
yarn startDocs