$app/paths
import { let assets: "" | `https://${string}` | `http://${string}` | "/_svelte_kit_assets"
An absolute path that matches config.kit.paths.assets
.
If a value for config.kit.paths.assets
is specified, it will be replaced with '/_svelte_kit_assets'
during vite dev
or vite preview
, since the assets don’t yet live at their eventual URL.
assets, let base: "" | `/${string}`
A string that matches config.kit.paths.base
.
Example usage: <a href="{base}/your-page">Link</a>
base, function resolveRoute(id: string, params: Record<string, string | undefined>): string
Populate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';
アセット
config.kit.paths.assets
と一致する絶対パス。
config.kit.paths.assets
の値が指定されている場合、vite dev
またはvite preview
の間は、アセットはまだ最終的な URL に存在しないため、'/_svelte_kit_assets'
に置き換えられます。
let assets:
| ''
| `https://${string}`
| `http://${string}`
| '/_svelte_kit_assets';
ベース
config.kit.paths.base
と一致する文字列。
使用例: <a href="{base}/your-page">Link</a>
let base: '' | `/${string}`;
resolveRoute
パス名を解決するために、パラメータを挿入したルート ID を入力します。
import { function resolveRoute(id: string, params: Record<string, string | undefined>): string
Populate a route ID with params to resolve a pathname.
resolveRoute } from '$app/paths';
function resolveRoute(id: string, params: Record<string, string | undefined>): string
Populate a route ID with params to resolve a pathname.
resolveRoute(
`/blog/[slug]/[...somethingElse]`,
{
slug: string
slug: 'hello-world',
somethingElse: string
somethingElse: 'something/else'
}
); // `/blog/hello-world/something/else`
function resolveRoute(
id: string,
params: Record<string, string | undefined>
): string;