sveltekit-headless-wp-rest-demo

Sveltekit Headless Wp Rest Demo

Connect SvelteKit to WordPress REST API. Styling via PicoCSS. Keep it simple!

SvelteKit Headless WP REST API demo

Work in progress. 👨‍💻

Live: https://sveltekit-headless-wp-rest-demo.vercel.app/

Content is fetched from WordPress demo backend https://nature-blog.mandrasch.eu/. Please use your own backend if you run big tests. The backend API URL can be configured in .env-file.

Local setup

npm install
# Copy .env.example to .env
npm run dev -- --open

Local backend (optional)

See https://github.com/mandrasch/sveltekit-headless-wp-rest-demo-backend and switch in .env-file to the following:

# .env
PUBLIC_WP_REST_API_DOMAIN=https://sveltekit-headless-wp-rest-demo.ddev.site

Deployment

TODOs

How was this created?

# Frontend - SvelteKit
npm create svelte@latest frontend
cd frontend
npm install

npm i @picocss/pico
# Add picocss - https://joyofcode.xyz/using-pico-css-with-svelte
npm i -D sass
npm i -D svelte-preprocess

# Gutenberg styles:
npm install @wordpress/block-library --save

Resources used

Credits

License

My own work (mostly config stuff) is available as CC0 / Public Domain, no need for attribution. Due to compatibility to SvelteKit and other packages, I also licensed this as MIT license.

Please see package.json for a list of all used Open Source libraries and their respective licenses.

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes