Get started
This page would get you started on creating your own pastel themed documentation.
Introduction
Hey ๐, you might wonder why I made this project?
The answer:
I got tired of re-using and sharing files and configurations among documentations I created. So this project is an attempt at creating a clean โ๏ธ โ performant ๐ โ and monochromatic ๐จ theme utilizing the power of layers
Quick start
For more information about layers
I suggest you checkout this page โ Authoring Nuxt Layers
Follow the steps below to have the base setup for your pastel themed documentation:
- Create a new project โ obviously.
- Add the following to the
nuxt.config.ts
Info: This command adds nuxt-pastel-docs
as a remote layer and its installs dependencies.
ts nuxt.config
export default defineNuxtConfig({
extends: [["github:oyedejioyewole/nuxt-pastel-docs", { install: true }]],
});
- Create a
content.config.ts
with the following content:
Info: This defines a schema where displayToc
determines whether the table of contents would be shown for content pages.
ts content.config
import { defineContentConfig, defineCollection, z } from "@nuxt/content";
export default defineContentConfig({
collections: {
content: defineCollection({
type: "page",
source: "**/*.md",
schema: z.object({
displayToc: z.boolean().default(false),
}),
}),
},
});
- Install
@nuxt/content
as adependency
Info: Apparently, if you don't install @nuxt/content
, it wouldn't be recognized in your project if you try and start the development server.
Perfect, now you can enjoy writing your documentation with my highly opinionated design takes โจ
Configuration
Now for the fun part, customization โจ.
Create an app.config.ts
app.config.ts
This allows you to customize properties like the features
list โ the themeColor
โ and the headline
etc. through the pastelDocs
object which follows this schema:
ts
interface AppConfig {
pastelDocs: {
features: string[];
footer: {
content: string; // markdown templates are also parsed.
iconLinks: Record<string, string>; // this is the format: { 'an-icon': 'https://example.com' }
};
headline: string;
icons: Record<string, string>; // this is the format: { 'an-icon': remappedIcon }
repo: string; // this is the format: your-username/your-repo
themeColor: string;
};
}
Overriding components
If you really don't like my design choices (kind of defeats the entire purpose of using this project) โ you can decide to roll out your own components and battle with keeping everything in balance.
The structure of the components
directory is given below:
This folder contains components that define sections in the theme.
A responsive footer component that displays markdown content and social/external links. It's minimalist by design and adapts to different screen sizes gracefully.
Features:
- Markdown support โ footer content is parsed from markdown, so you can include links, formatting, etc.
- Dynamic icons โ social and external links are rendered as icons using the phosphor-icons library
- Responsive layout โ centers content on small screens, spreads on larger screens
- Container queries โ uses modern CSS container queries for adaptive sizing
Configuration:
The footer pulls its content from app.config.ts
ts
export default defineAppConfig({
pastelDocs: {
footer: {
content: "Made with โค๏ธ by [Your Name](https://yoursite.com)",
icons: {
"github-logo": "https://github.com/yourusername",
"twitter-logo": "https://twitter.com/yourusername"
}
}
}
})
Extending theme styles
In cases you don't want to completely override components, you extend the existing styles with your own CSS classes or custom properties. This is where the locally registered theme module comes in handy.
The layer automatically registers a Nuxt module that creates a CSS template accessible via the #nuxt-pastel-docs
alias.
Usage
- Import the base theme styles in your own CSS file:
css assets/css/main.css
@import "#nuxt-pastel-docs";
- Register your CSS in your
nuxt.config.ts
ts nuxt.config.ts
export default defineNuxtConfig({
css: ["~/assets/css/main.css"],
});