astro-typed-links
v0.1.1
Published
An Astro integration to automatically get typed links to your pages.
Downloads
2
Maintainers
Readme
astro-typed-links
This is an Astro integration that automatically get typed links to your pages.
Usage
Prerequisites
- Requires Astro
>=4.12.0
Installation
Install the integration automatically using the Astro CLI:
pnpm astro add astro-typed-links
npx astro add astro-typed-links
yarn astro add astro-typed-links
Or install it manually:
- Install the required dependencies
pnpm add astro-typed-links
npm install astro-typed-links
yarn add astro-typed-links
- Add the integration to your astro config
+import typedLinks from "astro-typed-links";
export default defineConfig({
integrations: [
+ typedLinks(),
],
});
- Make sure you have a
sync
script inside yourpackage:json
{
"scripts": {
"sync": "astro sync"
}
}
- Update the sync command
{
"scripts": {
- "sync": "astro sync"
+ "sync": "astro build --sync && astro sync"
}
}
link
helper
Import link
from astro-typed-links
and that's it!
import { link } from 'astro-typed-links'
link('/')
link('/blog/[slug]', { params: { slug: 'foo' }})
link('/about', { searchParams: { foo: 'bar' }, hash: 'contact' })
Contributing
This package is structured as a monorepo:
playground
contains code for testing the packagepackage
contains the actual package
Install dependencies using pnpm:
pnpm i --frozen-lockfile
Start the playground and package watcher:
pnpm dev
You can now edit files in package
. Please note that making changes to those files may require restarting the playground dev server.
Licensing
MIT Licensed. Made with ❤️ by Florian Lefebvre.