Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: stup docs project #21

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.turbo
dist
.vercel
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vitepress
!.vitepress/config.mts
1 change: 1 addition & 0 deletions docs/guide/applying-styles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Applying Styles
1 change: 1 addition & 0 deletions docs/guide/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CLI
1 change: 1 addition & 0 deletions docs/guide/editor-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Editor Setup
1 change: 1 addition & 0 deletions docs/guide/file-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# File Structure
89 changes: 89 additions & 0 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
outline: deep
---

# Getting Started

## Setup

### Prerequisites

- [Node.js](https://nodejs.org/) version 18 or higher.

### Installation

::: code-group

```sh [npm]
$ npm add -D @titanom/css2tailwind
```

```sh [pnpm]
$ pnpm add -D @titanom/css2tailwind
```

```sh [yarn]
$ yarn add -D @titanom/css2tailwind
```

```sh [bun]
$ bun add -D @titanom/css2tailwind
```

:::

### Configuration

Add following scripts to your `package.json`.

```json
{
"scripts": {
"styles:build": "css2tailwind src/styles .styles", // [!code ++]
"styles:watch": "css2tailwind src/styles .styles --watch" // [!code ++]
}
}
```

::: warning
If you are type-checking `tailwind.config.ts`, make sure to build the styles beforehand.
:::

Edit your `tailwind.config.ts`.

```typescript
import plugin from 'tailwindcss/plugin.js'; // [!code ++]

import base from './.styles/base.json'; // [!code ++]
import utilities from './.styles/utilities.json'; // [!code ++]
import components from './.styles/components.json'; // [!code ++]

import type { Config } from 'tailwindcss';

const config = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
plugins: [ // [!code ++]
plugin( // [!code ++]
({ addComponents, addUtilities, addBase }) => { // [!code ++]
addBase(base); // [!code ++]
addUtilities(utilities); // [!code ++]
addComponents(components); // [!code ++]
}, // [!code ++]
), // [!code ++]
], // [!code ++]
} satisfies Config;

export default config;
```

Exclude the output directory from source-control.

```.gitignore
.styles // [!code ++]
```

Create the styles directory.

```sh
$ mkdir src/styles
```
16 changes: 16 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "@titanom/css2tailwind"
text: "A tool for compiling css files to CssInJs objects to be used inside tailwindcss plugins."
tagline: My great project tagline
actions:
- theme: brand
text: Get Started
link: /guide/getting-started
- theme: alt
text: View on GitHub
link: https://github.com/titanom/css2tailwind
---
15 changes: 15 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@css2tw/docs",
"private": true,
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview",
"format": "prettier --write .",
"format:check": "prettier --write ."
},
"dependencies": {
"vitepress": "1.0.0-rc.44"
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"lint:fix": "turbo lint:fix",
"types": "turbo types",
"release:dry": "turbo --filter @titanom/css2tailwind release:dry",
"release:ci": "turbo --filter @titanom/css2tailwind release:ci"
"release:ci": "turbo --filter @titanom/css2tailwind release:ci",
"docs:dev": "turbo --filter @css2tw/docs dev",
"docs:build": "turbo --filter @css2tw/docs build",
"docs:preview": "turbo --filter @css2tw/docs preview"
},
"devDependencies": {
"@changesets/changelog-github": "0.5.0",
Expand Down
Loading
Loading