Situs dasar
Di halaman ini
Situs sitelo terkecil yang berguna: satu halaman, satu lembar gaya, dan konfigurasi hosting yang menerbitkan dist/. Salin konfigurasinya ke proyek sitelo mana pun — semuanya hanya mengasumsikan npm run build → dist/.
Salinan yang bisa dijalankan ada di repositori sitelo, di bawah examples/basic/.
Yang Anda dapat
- Situs statis satu halaman yang dibangun dengan sitelo
netlify.toml,vercel.json,wrangler.toml, danamplify.yml- Penerapan sekali klik / sambung-repo dari folder contohnya
Tata letak proyek
my-site/
sitelo.config.js
netlify.toml # Netlify
vercel.json # Vercel
wrangler.toml # Cloudflare Pages
amplify.yml # AWS Amplify
package.json
src/
index.ht.js
css/
styles.cssexport default () => `
<html lang="id">
<head>
<title>sitelo — contoh dasar</title>
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<h1>Halo dari sitelo</h1>
</body>
</html>
`import { html, head, title, link, body, h1 } from 'javascript-to-html'
export default () =>
html({ lang: 'id' },
head(
title('sitelo — contoh dasar'),
link({ rel: 'stylesheet', href: '/styles.css' }),
),
body(h1('Halo dari sitelo')),
)export default function Home() {
return (
<html lang="id">
<head>
<title>sitelo — contoh dasar</title>
<link rel="stylesheet" href="/css/styles.css" />
</head>
<body>
<h1>Halo dari sitelo</h1>
</body>
</html>
)
}Build
npm install
npm run buildPenerapan
Dari monorepo sitelo, setel direktori akar/base platform ke examples/basic.
Netlify
[build]
command = "npm run build"
publish = "dist"Vercel
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": null,
"buildCommand": "npm run build",
"outputDirectory": "dist",
"installCommand": "npm install"
}Terapkan ke Vercel · Terapkan ke Netlify (setel direktori base ke examples/basic saat diminta).
Cloudflare Pages
Dasbor: perintah build npm run build, direktori keluaran dist. Atau npx wrangler pages deploy dist setelah build lokal.
name = "sitelo-basic"
compatibility_date = "2025-01-01"
pages_build_output_dir = "dist"AWS Amplify
Sambungkan repositorinya di Amplify Hosting. Untuk S3 + CloudFront biasa, build secara lokal lalu sinkronkan dist/ ke bucket.
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*Bekerja dengan Cursor, Copilot, atau agen lain? Salin AGENTS.md dari contoh ini (atau lihat Membangun dengan AI) agar perkakasnya tidak mengarang pola React/Next.
Memulai · Membangun dengan AI · Aplikasi todo · Contoh Island server