fix: setup tailwind for blogs (#39)

This commit is contained in:
Omkar Ghag
2024-02-20 17:27:18 +05:30
committed by GitHub
parent 31a9b021f1
commit ba461b4a9c
6 changed files with 1229 additions and 84 deletions

View File

@@ -2,57 +2,58 @@ import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight'; import starlight from '@astrojs/starlight';
import starlightBlog from 'starlight-blog'; import starlightBlog from 'starlight-blog';
import tailwind from "@astrojs/tailwind";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://opensaas.sh', site: 'https://opensaas.sh',
integrations: [ integrations: [starlightBlog({
starlightBlog({ title: 'Blog',
title: 'Blog', customCss: ['./src/styles/tailwind.css'],
authors: { authors: {
vince: { vince: {
name: 'Vince', name: 'Vince',
title: 'Dev Rel @ Wasp', title: 'Dev Rel @ Wasp',
picture: '/CRAIG_ROCK.png', // Images in the `public` directory are supported. picture: '/CRAIG_ROCK.png',
url: 'https://wasp-lang.dev', // Images in the `public` directory are supported.
}, url: 'https://wasp-lang.dev'
}, }
}), }
starlight({ }), starlight({
title: 'Your SaaS', title: 'Your SaaS',
description: 'Documentation for your SaaS.', customCss: ['./src/styles/tailwind.css'],
logo: { description: 'Documentation for your SaaS.',
src: '/src/assets/logo.png', logo: {
alt: 'Your SaaS', src: '/src/assets/logo.png',
}, alt: 'Your SaaS'
editLink: { },
baseUrl: 'https://github.com/<your-repo>', editLink: {
}, baseUrl: 'https://github.com/<your-repo>'
components: { },
SiteTitle: './src/components/MyHeader.astro', components: {
MarkdownContent: 'starlight-blog/overrides/MarkdownContent.astro', SiteTitle: './src/components/MyHeader.astro',
Sidebar: 'starlight-blog/overrides/Sidebar.astro', MarkdownContent: 'starlight-blog/overrides/MarkdownContent.astro',
// ThemeSelect: 'starlight-blog/overrides/ThemeSelect.astro', Sidebar: 'starlight-blog/overrides/Sidebar.astro'
}, // ThemeSelect: 'starlight-blog/overrides/ThemeSelect.astro',
social: { },
github: 'https://github.com/wasp-lang/open-saas',
twitter: 'https://twitter.com/wasp_lang',
discord: 'https://discord.gg/aCamt5wCpS',
},
sidebar: [
{
label: 'Start Here',
items: [
{ label: 'Introduction', link: '/' },
],
},
{
label: 'Guides',
items: [
{ label: 'Example Guide', link: '/guides/example/' },
], social: {
}, github: 'https://github.com/wasp-lang/open-saas',
], twitter: 'https://twitter.com/wasp_lang',
}), discord: 'https://discord.gg/aCamt5wCpS'
], },
sidebar: [{
label: 'Start Here',
items: [{
label: 'Introduction',
link: '/'
}]
}, {
label: 'Guides',
items: [{
label: 'Example Guide',
link: '/guides/example/'
}]
}]
}), tailwind({applyBaseStyles: false})]
}); });

1180
blog/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,9 +12,12 @@
"dependencies": { "dependencies": {
"@astrojs/check": "^0.3.1", "@astrojs/check": "^0.3.1",
"@astrojs/starlight": "^0.13.0", "@astrojs/starlight": "^0.13.0",
"@astrojs/starlight-tailwind": "^2.0.1",
"@astrojs/tailwind": "^5.1.0",
"astro": "^3.2.3", "astro": "^3.2.3",
"sharp": "^0.32.5", "sharp": "^0.32.5",
"starlight-blog": "^0.4.0", "starlight-blog": "^0.4.0",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.2" "typescript": "^5.3.2"
} }
} }

View File

@@ -30,15 +30,15 @@ const href = Astro.site
</> </>
) )
} }
<span class:list={{ 'sr-only': config.logo?.replacesTitle }}> <span class:list={{ 'sr-only': config.logo?.replacesTitle }} class="dark:text-white hover:text-yellow-500">
{config.title} {config.title}
</span> </span>
</a> </a>
<div> <div>
<a href="/">Docs</a> <a href="/" class="text-gray-900 hover:text-yellow-500 dark:text-white">Docs</a>
</div> </div>
<div> <div>
<a href="/blog">{blogConfig.title}</a> <a href="/blog" class="text-gray-900 hover:text-yellow-500 dark:text-white">{blogConfig.title}</a>
</div> </div>
<style> <style>
@@ -47,10 +47,10 @@ const href = Astro.site
max-width: 100%; max-width: 100%;
overflow: hidden; overflow: hidden;
align-items: center; align-items: center;
color: var(--sl-color-gray-9);
gap: var(--sl-nav-gap); gap: var(--sl-nav-gap);
font-size: var(--sl-text-h4); font-size: var(--sl-text-h4);
font-weight: 600; font-weight: 600;
color: var(--sl-color-text-accent);
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
padding-inline-end: 1rem; padding-inline-end: 1rem;

View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

18
blog/tailwind.config.mjs Normal file
View File

@@ -0,0 +1,18 @@
import starlightPlugin from "@astrojs/starlight-tailwind";
import colors from "tailwindcss/colors";
const yellow = colors.yellow
const gray = colors.gray
/** @type {import('tailwindcss').Config} */
export default {
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: {
extend: {
colors: {
accent: yellow, gray
},
},
},
plugins: [starlightPlugin()],
};