alexweininger / nextjs-test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A NextJS template with typescript, tailwindcss and storybook support

The configuration of NextJS, TailwindCSS and Storybook can be complex 😰 πŸ€ͺ πŸ‘‰ So we have decided to make this template public πŸŽ‰

This project was bootstrapped with npx create-next-app and we have added support for:

You are welcome to contribute to this project to make it better. Contact us at contact@elitizon.com

Created with ❀️ by Elitizon

This template is available at https://github.com/elitizon/nextjs-tailwind-storybook

To use this template:

  • clone it
  • remove the .git folder
  • git init .
  • git add .
  • git commit -m "First commit"

Structure of the template

.
β”œβ”€β”€ CODE_OF_CONDUCT.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ SECURITY.md
β”œβ”€β”€ build.toml
β”œβ”€β”€ next-env.d.ts
β”œβ”€β”€ nextjs.config.js
β”œβ”€β”€ out
β”‚   β”œβ”€β”€ 404.html
β”‚   β”œβ”€β”€ _next
β”‚   β”œβ”€β”€ favicon.ico
β”‚   β”œβ”€β”€ index.html
β”‚   └── vercel.svg
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.js
β”œβ”€β”€ public
β”‚   β”œβ”€β”€ favicon.ico
β”‚   └── vercel.svg
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ assets
β”‚   β”œβ”€β”€ components
β”‚   β”œβ”€β”€ pages
β”‚   └── styles
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ tsconfig.json
└── yarn.lock

Pages and components are developed in src directory.

Install all the dependencies

πŸ‘‰ yarn install

Available Scripts

In the project directory, you can run:

πŸ‘‰ yarn dev

Results:

ready - started server on http://localhost:3000
   βœ… purgeEnabled=false

event - compiled successfully
event - build page: /next/dist/pages/_error
wait  - compiling...
event - compiled successfully
event - build page: /
wait  - compiling...```

Run the project in the dev mode.

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

πŸ‘‰ yarn storybook

Runs storybook.

Open http://localhost:6006 to view it in the browser.

πŸ‘‰ yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

If you get an error that contained this line:

Use this command:

brew install watchman

πŸ‘‰yarn build

Builds the app for production to the .next folder.
It correctly bundles NextJS in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

πŸ‘‰ Result of execution

yarn run v1.22.10
$ cross-env NODE_ENV=production next build
info  - Creating an optimized production build...


   TailwindCSS

   -----------

   βœ… purgeEnabled=true

info  - Compiled successfully
info  - Collecting page data...
info  - Generating static pages (0/2)
info  - Generating static pages (2/2)
info  - Finalizing page optimization...

Page                                                           Size     First Load JS
β”Œ β—‹ /                                                          1.55 kB        64.3 kB
β”œ   /_app                                                      0 B            62.7 kB
β”œ β—‹ /404                                                       3.46 kB        66.2 kB
β”” Ξ» /api/hello                                                 0 B            62.7 kB
+ First Load JS shared by all                                  62.7 kB
  β”œ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.d4f570.js  13.1 kB
  β”œ chunks/framework.abffcf.js                                 41.8 kB
  β”œ chunks/main.1fee81.js                                      6.62 kB
  β”œ chunks/pages/_app.1315ea.js                                523 B
  β”œ chunks/webpack.50bee0.js                                   751 B
  β”” css/ff7ad52a1259dc7bd680.css                               1.88 kB

Ξ»  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
β—‹  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)

Done in 9.00s.

See the section about deployment for more information.

πŸ‘‰yarn start

Starts a server with the output for the yarn build command.

yarn build must be executed before to use this command.

πŸ‘‰yarn export

Export the output of the yarn build command execution to the ./out directory.

yarn build must be executed before to use this command.

πŸ‘‰npx serve ./out

To launch a static server from the ./out directory. This command can be useful to control the outcome of yarn export.

yarn build and yarn export must be executed before to use this command.

Learn More

You can learn more in the NextJS documentation.

To learn React, check out the React documentation.

To learn how to develop UIs with component and design systems with Storybook, check out the Learn Storybook documentation

About

License:MIT License


Languages

Language:JavaScript 51.0%Language:TypeScript 48.4%Language:CSS 0.6%