Subpath aliases
By default, corgi sets up a subpath aliasing to help you manage your imports. This becomes especially useful when importing modules from within deeply-nested components or pages.
The following aliases are available:
alias | location |
---|---|
@local | src/ |
Usage
JavaScript imports
import { Button } from "@local/components"
import { useLocale } from "@local/hooks"
Component indexing
Notice the above Button component is imported from "@local/components"
. This assumes that you are exporting your Button component from /src/components/index.jsx
. Otherwise, you still need to write the path to your component (i.e. @local/components/button/button
).
SCSS imports
The following snippet is just an example — the styles directory does not exist out-of-the-box on a corgi project.
@use "@local/styles/helpers/helpers-animation" as *;
@use "@local/styles/helpers/helpers-math" as *;