Skip to content

Commit b7a615b

Browse files
committed
docs(docs): add styles documentation
1 parent 48e2f09 commit b7a615b

File tree

2 files changed

+56
-12
lines changed

2 files changed

+56
-12
lines changed

docs/.vitepress/config.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,27 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
3939
collapsed: true,
4040
items: [
4141
{ link: '/codebase/monorepo/', text: 'Monorepo' },
42-
{ collapsed: true, items: [
43-
{ link: '/codebase/packages/config-tailwind', text: '@stack/config-tailwind' },
44-
{ link: '/codebase/packages/supabase', text: '@stack/supabase' },
45-
{ link: '/codebase/packages/actions', text: '@stack/actions' },
46-
{ link: '/codebase/packages/layouts', text: '@stack/layouts' },
47-
{ link: '/codebase/packages/ui', text: '@stack/ui' },
48-
{ link: '/codebase/packages/utils', text: '@stack/utils' }
49-
], text: 'Packages' },
50-
{ collapsed: true, items: [
51-
{ link: '/codebase/apps/finance', text: '@stack/finance' },
52-
{ link: '/codebase/apps/i18n', text: '@stack/i18n' }
53-
], text: 'Apps' },
42+
{ link: '/codebase/styles', text: 'Styles' },
43+
{
44+
collapsed: true,
45+
items: [
46+
{ link: '/codebase/packages/config-tailwind', text: '@stack/config-tailwind' },
47+
{ link: '/codebase/packages/supabase', text: '@stack/supabase' },
48+
{ link: '/codebase/packages/actions', text: '@stack/actions' },
49+
{ link: '/codebase/packages/layouts', text: '@stack/layouts' },
50+
{ link: '/codebase/packages/ui', text: '@stack/ui' },
51+
{ link: '/codebase/packages/utils', text: '@stack/utils' }
52+
],
53+
text: 'Packages'
54+
},
55+
{
56+
collapsed: true,
57+
items: [
58+
{ link: '/codebase/apps/finance', text: '@stack/finance' },
59+
{ link: '/codebase/apps/i18n', text: '@stack/i18n' }
60+
],
61+
text: 'Apps'
62+
},
5463
{ link: '/codebase/turbo', text: 'Turbo' },
5564
{ link: '/codebase/supabase', text: 'Supabase' }
5665
],

docs/codebase/styles.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Styles - Tailwind
3+
editLink: true
4+
---
5+
6+
# Styles
7+
8+
All applications in `@stack` are based using [Tailwind
9+
CSS](https://tailwindcss.com/). One important thing to note, is that each
10+
package or application has its own generated `styles.css` file. Furthermore, if
11+
an app is using a package (such as `@stack/ui`) that has its own `styles.css`
12+
file, this will be imported in the app's global CSS definition. This could mean
13+
that the combination of some packages could result in a lot of CSS being
14+
generated, since for each package, there would be an entire Tailwind stylesheet
15+
generated, plus the app's own.
16+
17+
## Package CSS relationship
18+
19+
The following list, shows the relationship between packages. If you import a
20+
package from `root`, as well as any of `leaf`, you **do not need to import the
21+
`leaf` package generated CSS**. This is because the `root` package already
22+
imports the `leaf` package generated CSS.
23+
24+
| Root package | Leaf package | Generated CSS |
25+
| ------------ | ------------ | ------------- |
26+
27+
This also applies to tailwind functions and utilities (`@base`,`@components` and
28+
`@utilities`). If you import a package that exports a `styles.css`, and you
29+
reference that import, there's no need to import the rest from Tailwind.
30+
31+
::: tip NOTE
32+
In order to avoid class collisions, each package has its own Tailwind class
33+
prefix. In apps, it's recommended not to use any prefix, as apps should always
34+
be the end of this import mess.
35+
:::

0 commit comments

Comments
 (0)