-
18 |
-
19 | Get started by editing{" "}
20 |
src/app/page.tsx
21 |
22 | - 23 | Save and see your changes instantly. 24 | 25 |
├── .eslintrc.json ├── .gitignore ├── .stylex.json5 ├── README.md ├── next.config.mjs ├── package-lock.json ├── package.json ├── public ├── file-text.svg ├── globe.svg ├── next.svg ├── vercel.svg └── window.svg ├── source └── app │ ├── favicon.ico │ ├── fonts │ ├── GeistMonoVF.woff │ └── GeistVF.woff │ ├── globals.css │ ├── layout.tsx │ ├── page.tsx │ └── tokens.stylex.ts └── tsconfig.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | /src/ 10 | 11 | # testing 12 | /coverage 13 | 14 | # next.js 15 | /.next/ 16 | /out/ 17 | 18 | # production 19 | /build 20 | 21 | # misc 22 | .DS_Store 23 | *.pem 24 | 25 | # debug 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | 30 | # env files (can opt-in for commiting if needed) 31 | .env* 32 | 33 | # vercel 34 | .vercel 35 | 36 | # typescript 37 | *.tsbuildinfo 38 | next-env.d.ts 39 | -------------------------------------------------------------------------------- /.stylex.json5: -------------------------------------------------------------------------------- 1 | { 2 | input: ["./source"], 3 | output: ["./src"], 4 | cssBundleName: "stylex_bundle.css", 5 | useCSSLayers: true, 6 | babelPresets: [ 7 | ["@babel/preset-typescript", { allExtensions: true, isTSX: true }], 8 | // '@babel/preset-react', 9 | ], 10 | // modules_EXPERIMENTAL: [ 11 | // ['@stylexjs/open-props', { ignore: ['src', '__tests__'] }], 12 | // ], 13 | // watch: true, 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load Inter, a custom Google Font. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. 37 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | export default nextConfig; 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "next-15-with-stylex-cli", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "predev": "stylex --config ./.stylex.json5", 7 | "dev": "stylex --config ./.stylex.json5 -w & next dev", 8 | "prestart": "stylex --config ./.stylex.json5 && next build", 9 | "start": "next start", 10 | "lint": "next lint" 11 | }, 12 | "dependencies": { 13 | "@stylexjs/stylex": "0.7.5", 14 | "next": "15.0.0-rc.0", 15 | "react": "19.0.0-rc-f994737d14-20240522", 16 | "react-dom": "19.0.0-rc-f994737d14-20240522" 17 | }, 18 | "devDependencies": { 19 | "@babel/preset-typescript": "^7.24.7", 20 | "@stylexjs/babel-plugin": "0.7.5", 21 | "@stylexjs/cli": "0.7.5", 22 | "@stylexjs/eslint-plugin": "0.7.5", 23 | "@types/node": "^20", 24 | "@types/react": "^18", 25 | "@types/react-dom": "^18", 26 | "eslint": "^8", 27 | "eslint-config-next": "15.0.0-rc.0", 28 | "typescript": "^5", 29 | "yargs": "^17.7.2" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /public/file-text.svg: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /public/globe.svg: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /public/window.svg: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /source/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmn/next-15-with-stylex-cli/b3501eec7fc71f865163220793652c36ddcf2661/source/app/favicon.ico -------------------------------------------------------------------------------- /source/app/fonts/GeistMonoVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmn/next-15-with-stylex-cli/b3501eec7fc71f865163220793652c36ddcf2661/source/app/fonts/GeistMonoVF.woff -------------------------------------------------------------------------------- /source/app/fonts/GeistVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmn/next-15-with-stylex-cli/b3501eec7fc71f865163220793652c36ddcf2661/source/app/fonts/GeistVF.woff -------------------------------------------------------------------------------- /source/app/globals.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | padding: 0; 4 | margin: 0; 5 | } 6 | 7 | a { 8 | color: inherit; 9 | text-decoration: none; 10 | } 11 | -------------------------------------------------------------------------------- /source/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import localFont from "next/font/local"; 3 | import "./globals.css"; 4 | 5 | import * as stylex from "@stylexjs/stylex"; 6 | import { colors } from "./tokens.stylex"; 7 | 8 | const geistSans = localFont({ 9 | src: "./fonts/GeistVF.woff", 10 | variable: "--geist-sans", 11 | }); 12 | const geistMono = localFont({ 13 | src: "./fonts/GeistMonoVF.woff", 14 | variable: "--geist-mono", 15 | }); 16 | 17 | export const metadata: Metadata = { 18 | title: "Create Next App with StyleX CLI", 19 | description: "Generated by create next app", 20 | }; 21 | 22 | export default function RootLayout({ 23 | children, 24 | }: Readonly<{ 25 | children: React.ReactNode; 26 | }>) { 27 | return ( 28 | 29 |
34 | {children} 35 | 36 | 37 | ); 38 | } 39 | 40 | const styles = stylex.create({ 41 | base: { 42 | maxWidth: "100vw", 43 | overflowX: "hidden", 44 | }, 45 | html: { 46 | colorScheme: "light dark", 47 | }, 48 | body: { 49 | color: colors.fg, 50 | backgroundColor: colors.bg, 51 | }, 52 | }); 53 | -------------------------------------------------------------------------------- /source/app/page.tsx: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | import * as stylex from "@stylexjs/stylex"; 3 | import { colors, fonts } from "./tokens.stylex"; 4 | 5 | export default function Home() { 6 | return ( 7 |src/app/page.tsx
21 |