@yoamigo.com/core
v1.5.1
Published
Core components, router, and utilities for YoAmigo templates
Downloads
152
Maintainers
Readme
@yoamigo/core
Core components, Vite plugin, and utilities for building YoAmigo templates.
Installation
npm install @yoamigo/coreUsage
Vite Plugin
Add the YoAmigo plugin to your vite.config.ts:
import { defineConfig } from 'vite'
import { yoamigoPlugin } from '@yoamigo/core/plugin'
export default defineConfig({
plugins: [yoamigoPlugin()],
})The plugin automatically handles:
- React/Preact swap in production builds
- Path aliases (
@/maps tosrc/) - Environment variables (
YA_*prefix) - Optimized build output
Components
Use the editable components in your templates:
import { YaText, YaImage, YaLink, ContentStoreProvider } from '@yoamigo/core'
function App() {
return (
<ContentStoreProvider>
<h1>
<YaText fieldId="hero.title" />
</h1>
<YaImage fieldId="hero.image" className="hero-img" />
<YaLink fieldId="hero.cta" className="btn">
<YaText fieldId="hero.cta.text" />
</YaLink>
</ContentStoreProvider>
)
}Router
A lightweight router for multi-page templates:
import { Router, Route, Link, useLocation } from '@yoamigo/core/router'
function App() {
return (
<Router>
<nav>
<Link href="/">Home</Link>
<Link href="/about">About</Link>
</nav>
<Route path="/" component={Home} />
<Route path="/about" component={About} />
</Router>
)
}Documentation
For full documentation, visit yoamigo.com/developers.
License
Proprietary - All Rights Reserved. See LICENSE file for details.
