Installation
Multiple ways to add PACE.js to your project.
NPM (Recommended)
bash
npm install @semanticintent/pace-patternjavascript
import { PACE } from '@semanticintent/pace-pattern'
const pace = new PACE({
container: '#app',
products: './products.json'
})
pace.mount()CDN
ESM (Modern Browsers)
html
<script type="module">
import { PACE } from 'https://cdn.jsdelivr.net/npm/@semanticintent/pace-pattern/dist/pace.esm.js'
const pace = new PACE({
container: '#app',
products: './products.json'
})
pace.mount()
</script>UMD (Universal)
html
<script src="https://cdn.jsdelivr.net/npm/@semanticintent/pace-pattern/dist/pace.min.js"></script>
<script>
const pace = new PACE.PACE({
container: '#app',
products: './products.json'
})
pace.mount()
</script>Download
Download the latest release from GitHub:
Files included:
pace.min.js— Minified UMD build (15KB)pace.esm.js— ESM build for bundlerspace.min.css— Optional stylesproducts.json— Example data structure
Project Structure
After installation, create this structure:
your-project/
├── index.html
├── products.json
├── pace.min.css (optional)
└── app.jsindex.html
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My PACE App</title>
<link rel="stylesheet" href="pace.min.css">
</head>
<body>
<div id="app"></div>
<script type="module" src="app.js"></script>
</body>
</html>app.js
javascript
import { PACE } from '@semanticintent/pace-pattern'
const pace = new PACE({
container: '#app',
products: './products.json',
greeting: 'Welcome! What can I help you find?'
})
pace.mount()products.json
json
{
"products": [
{
"id": "product-1",
"name": "Your Product",
"tagline": "Short description",
"category": "Tools",
"description": "## Full Description\n\nMarkdown supported!",
"action_label": "Get Started",
"action_url": "https://example.com"
}
]
}Build Tools
Vite
javascript
// vite.config.js
import { defineConfig } from 'vite'
export default defineConfig({
// PACE.js works out of the box
})Webpack
javascript
// webpack.config.js
module.exports = {
entry: './app.js',
output: {
filename: 'bundle.js'
}
}Rollup
javascript
// rollup.config.js
export default {
input: 'app.js',
output: {
file: 'bundle.js',
format: 'iife'
}
}Parcel
bash
parcel index.htmlPACE.js is bundler-agnostic. Use any tool you prefer.
Framework Integration
React
bash
npm install @semanticintent/pace-pattern @semanticintent/pace-reactjsx
import { PACEReact } from '@semanticintent/pace-react'
function App() {
return (
<PACEReact
products="./products.json"
greeting="Welcome to our store!"
/>
)
}Vue
bash
npm install @semanticintent/pace-pattern @semanticintent/pace-vuevue
<template>
<pace-component :config="paceConfig" />
</template>
<script>
import { PACEVue } from '@semanticintent/pace-vue'
export default {
components: { PACEVue },
data() {
return {
paceConfig: {
products: './products.json'
}
}
}
}
</script>Svelte
bash
npm install @semanticintent/pace-pattern @semanticintent/pace-sveltesvelte
<script>
import PACE from '@semanticintent/pace-svelte'
const config = {
products: './products.json'
}
</script>
<PACE {config} />Framework Adapters
React, Vue, and Svelte adapters are coming soon. For now, use the vanilla JavaScript version with a simple wrapper component.
TypeScript Support
PACE.js is written in vanilla JavaScript, but includes TypeScript definitions:
typescript
import { PACE, PACEConfig, Product } from '@semanticintent/pace-pattern'
const config: PACEConfig = {
container: '#app',
products: './products.json'
}
const pace = new PACE(config)
pace.mount()Verify Installation
Test your setup:
javascript
import { PACE } from '@semanticintent/pace-pattern'
console.log(PACE.version) // "1.0.1"
const pace = new PACE({
container: '#app',
products: {
products: [
{
id: 'test',
name: 'Test Product',
tagline: 'It works!',
description: 'PACE.js is installed correctly.'
}
]
}
})
pace.mount()If you see a purple interface with "Test Product" — you're ready to build!
Troubleshooting
Module not found
Error: Cannot find module '@semanticintent/pace-pattern'Solution:
bash
rm -rf node_modules package-lock.json
npm installPACE is not defined
Uncaught ReferenceError: PACE is not definedSolution:
Using UMD? Access via PACE.PACE:
javascript
const pace = new PACE.PACE({ ... })Using ESM? Import first:
javascript
import { PACE } from '@semanticintent/pace-pattern'CSS not loading
Solution:
Add the stylesheet:
html
<link rel="stylesheet" href="pace.min.css">Or import in JavaScript:
javascript
import '@semanticintent/pace-pattern/dist/pace.min.css'Next Steps
Installation complete! Now:
- Quick Start — Build your first PACE app (5 minutes)
- Core Concepts — Understand how PACE.js works
- Components — Learn the four core components
- API Reference — Complete API documentation
Ready to build with PACE.js! 🚀