Skip to content

astrolicious/astro-theme-provider

astro-theme-provider

npm version beta

Author themes for Astro like a normal project and export your work as an integration for others to use

Contributing

Example

Authoring a Theme:

package/
├── public/
├── src/
│   ├── assets/
│   ├── components/
│   ├── layouts/
│   ├── pages/
│   └── styles/
├── index.ts
└── package.json
// package/index.ts
import defineTheme from 'astro-theme-provider';
import { z } from 'astro/zod'

export default defineTheme({
  schema: z.object({
    title: z.string(),
  })
})

Using a Theme:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import Blog from 'blog-theme';

export default defineConfig({
  integrations: [
    Blog({
      config: {
        title: "My Blog"
      },
      pages: {
        '/404': false, // Toggle routes off
        '/blog': '/projects', // Overwrite routes
      },
      overrides: {
        components: {
          Hero: './src/Custom.astro' // Overwrite theme assets
        },
        styles: [
          "./src/custom.css" // Add custom stylesheets
        ],
      },
    }),
  ],
});

About

Author themes for Astro like a normal project and export your work as an integration for others to use

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published