Tailwind Setup via CLI
Overview
Practice installing Tailwind CSS for NEW projects
Create build process for apps using Tailwind CSS
Install Tailwind CSS using the CLI tool
Setup repo with Node and npm package manager
Create a new repo with

Open newly created repo in CodeSpaces
From the Terminal
Setup
npmproject with common defaults
A new file named
package.jsonwill automatically be created
npmis the package manager, but does not run/execute ita new file named
package-lock.jsonwill automatically be createda new folder named
node_moduleswill automatically be created
Tailwind is downloaded but installed, but is not running or configured
a new file named
tailwind.config.jswill automatically be created
Create these folders and files
src/input.csspublic/index.htmlpublic/style.csspublic/script.js
Open
tailwind.config.jsfind
content :keymodify value to
What is happening now? We're configure the paths the HTML template or JS components. Or "Tailwind put all the compiled code in this folder" named public
Add the @tailwind directives
open
src/input.cssadd this code
For right now, copy all this code.
7. Start the Tailwind CLI build process
The shortcut we created is
use
npmto get the sourceinput.csscompile tostyle.css--watchfor any changes oninput.css, then re-compile tostyle.css
Setup boilder plate for HTML in
public/index.htmlWrite all CSS in
src/style.cssWrite all JS in
public/script.js
Run Live Server on
index.htmlClick on
publicfolder to view in browser
Note: index.html is public/index.html
Last updated