Skip to content

Commit 8d003c5

Browse files
committed
chore: setup css module
1 parent 9878835 commit 8d003c5

File tree

10 files changed

+808
-6
lines changed

10 files changed

+808
-6
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
// "explorer.fileNesting.expand": false,
1515
"explorer.fileNesting.patterns": {
1616
"tsconfig.json": "tsconfig.tsbuildinfo",
17+
"next.config.ts": "next-env.d.ts",
1718
"package.json": "pnpm-lock.yaml",
18-
"readme.md": "license"
19+
"readme.md": "license, contributing.md"
1920
},
2021

22+
// Support ts plugin including css modules.
23+
"typescript.tsdk": "node_modules/typescript/lib",
24+
2125
// Code spell checker (require recommended extensions).
2226
"cSpell.ignorePaths": [
2327
".next",

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Contributing to VibeSpecifier Code
2+
3+
WIP.
4+
5+
## Environment Setup
6+
7+
If you are using VSCode as code editor (also the recommended code editor for this project), select the `typescript` version of this project from `node_modules`, rather than using the default `typescript` version in VSCode, or the [CSS Module Plugin for TypeScript](https://www.npmjs.com/package/typescript-plugin-css-modules) might not work, which will cause inconvenience when using CSS Modules.
8+
9+
1. Open any TypeScript file in VSCode in this repository.
10+
2. Open the command panel (usually ⇧⌘P or Shift+Ctrl+P) and search for the `TypeScript: Select TypeScript Version...` command.
11+
3. Select `Use Workspace Version` instead of `Use VSCode Version`.

app/global.scss

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
body {
2+
margin: 0;
3+
height: 100vh;
4+
overflow: hidden;
5+
user-select: none;
6+
font-family: sans-serif;
7+
}
8+
9+
// Adaptive theme at root.
10+
body {
11+
background-color: var(--background);
12+
color: var(--foreground);
13+
14+
$light-foreground: #232526;
15+
$light-background: #fefdfa;
16+
$dark-foreground: #cdcbca;
17+
$dark-background: #212323;
18+
19+
@media (prefers-color-scheme: light) {
20+
--foreground: #{$light-foreground};
21+
--background: #{$light-background};
22+
}
23+
24+
@media (prefers-color-scheme: dark) {
25+
--foreground: #{$dark-foreground};
26+
--background: #{$dark-background};
27+
}
28+
}

app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "@app/global.scss"
12
import { Metadata } from "next"
23
import { ReactNode } from "react"
34

app/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import utils from "@components/utils.module.scss"
2+
13
export default function Home() {
2-
return <div>Placeholder</div>
4+
return <div className={utils.placeholder}>Placeholder</div>
35
}

components/utils.module.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.container {
2+
position: relative;
3+
width: 100%;
4+
height: 100%;
5+
}
6+
7+
.center {
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
}
12+
13+
.placeholder {
14+
@extend .container;
15+
@extend .center;
16+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"oxlint": "^1.14.0",
2323
"prettier": "^3.6.2",
2424
"prettier-plugin-sh": "^0.18.0",
25-
"typescript": "^5.9.2"
25+
"typescript": "^5.9.2",
26+
"typescript-plugin-css-modules": "^5.2.0"
2627
}
2728
}

0 commit comments

Comments
 (0)