Creating a new app with tailwindcss
cd apps
npx create-next-app@latest
Add globals.css
inside apps
Change .eslintrc.json
to .eslintrc.js
module . exports = {
root : true ,
extends : [ "custom" ] ,
} ;
Delete .gitignore
(only keep one global file)
Update package.json
to import from local packages
dependencies
"ui": "*"
devDependencies
"eslint-config-custom": "*",
"tailwind-config": "*",
"tsconfig": "*",
Update tailwind.config.js
to include files to compile
/** @type {import('tailwindcss').Config } */
const sharedConfig = require ( 'tailwind-config' ) ;
module . exports = {
...sharedConfig ,
content : [
'./app/**/*.{js,ts,jsx,tsx,mdx}' ,
'./components/**/*.{js,ts,jsx,tsx,mdx}' ,
'../../packages/ui/**/*.{js,ts,jsx,tsx,mdx}'
]
}
Update next.config.js
to include files to transpile
/** @type {import('next').NextConfig } */
const nextConfig = {
reactStrictMode : true ,
transpilePackages : [ "ui" , "tailwind-config" ] ,
}
module . exports = nextConfig
Update tsconfig.json
{
"extends" : " tsconfig/nextjs.json" ,
"compilerOptions" : {
"plugins" : [
{
"name" : " next"
}
],
"paths" : {
"@/*" : [" ./*" ]
}
},
"include" : [" next-env.d.ts" , " **/*.ts" , " **/*.tsx" , " .next/types/**/*.ts" ],
"exclude" : [" node_modules" ]
}