Skip to content

anhttok/demo-nextjs-tailwindcss

Repository files navigation

Demo TailwindCSS NextJS

Guide setup TailwindCSS for NextJS

GitHub Workflow Status GitHub last commit node-current GitHub

Getting StartedDocumentationNeed Help?AboutLicense


Introduction

  1. You want setup Tailwind CSS for Next JS.
  2. This project will help you understand and how can setup TailwindCSS and SCSS for NextJS

Demo TailwindCSS NextJS is a small project for basic setup TailwindCSS for NextJS.


Key Features


Usage

# install libs
yarn
# run dev
yarn dev
# generate
yarn export

Getting Started

Structure

.
├── 📁 assets
   ├── 📁 styles
   ├── ├── 📝 tailwind.css
      └── 📝 globals.scss
   └── 📁 images
├── 📁 components
   ├── 📁 common
   └── 📁 partials
├── 📁 layouts
   ├── 📁 components
   └── 📝 default.jsx
├── 📁 pages
   ├── 📝 _app.jsx
   ├── 📝 _document.jsx
   ├── 📝 index.jsx
   ├── 📝 demo.jsx
   └── 📝 user.jsx
├── 📁 public
├── 📝 .env
├── 📝 .env.development
├── 📝 .env.production
├── 📝 jsconfig.js
├── 📝 next.config.js
├── 📝 postcss.config.js
├── 📝 tailwind.config.js
└── 📝 README.md

Prerequisites

Documentation

Configuration

  • Install lib
yarn add -D sass tailwindcss postcss autoprefixer

API

  1. Create file config postcss postcss.config.js
module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}
  1. Create file config tailwind tailwind.config.js
module.exports = {
  purge: ['./layouts/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}
  1. Create file /assets/styles/tailwind.css
@tailwind base;
/* Write your own custom base styles here */

/* Start purging... */
@tailwind components;
/* Stop purging. */

/* Start purging... */
@tailwind utilities;
/* Stop purging. */
  1. Create file style /assets/styles/globals.scss

  2. Remove folder /styles

Performance and testing

Any of testing activities and reports goes here.


Support

Get Help

You have a question or problem wasn't solved? No worries! Just open up a new issue in the GitHub issue tracker. Please provide all information to reproduce your problem. If you don't have a GitHub account, you can contact me directly.


About

Known Issues

  • none (that are reported)

Contact

If you haven't done so already, please check out Get Help for the fastest possible help on your issue. Alternatively you can get in touch with me by:


License

This project is proudly licensed under the MIT license.

About

Guide setup TailwindCSS for NextJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published