-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.sh
111 lines (93 loc) · 2.04 KB
/
tailwind.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -e
# Initializes a new Node.js project
initialize_node_project() {
npm init -y
}
# Installs TailwindCSS and creates the configuration files
install_tailwindcss() {
echo "Installing TailwindCSS..."
npm install -D tailwindcss
npx tailwindcss init
mkdir -p css js
touch index.html input.css css/styles.css js/main.js
local project_name=${PWD##*/}
cat > package.json <<EOF
{
"name": "$project_name",
"version": "1.0.0",
"description": "",
"main": "js/main.js",
"scripts": {
"build": "npx tailwindcss -i input.css -o css/styles.css",
"watch": "npx tailwindcss -i input.css -o css/styles.css --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"tailwindcss": "^3.2.1"
}
}
EOF
cat > input.css <<EOF
@tailwind base;
@tailwind components;
@tailwind utilities;
EOF
cat > tailwind.config.js <<EOF
module.exports = {
content: ["./*.html"],
theme: {
screens: {
sm: "480px",
md: "768px",
mg: "976px",
xl: "1440px"
},
extend: {},
},
plugins: [],
}
EOF
cat > index.html <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/styles.css">
<script src="js/main.js" defer></script>
</head>
<body>
Hello World
</body>
</html>
EOF
}
# Installs Prettier and the TailwindCSS plugin
install_prettier() {
echo "Installing Prettier for Tailwind..."
npm install -D prettier prettier-plugin-tailwindcss
cat > prettier.config.js <<EOF
module.exports = {
plugins: [require('prettier-plugin-tailwindcss')],
}
EOF
}
# Initializes a new Git repository
initialize_git_repository() {
if command -v git &> /dev/null; then
git init
echo 'node_modules' > .gitignore
git add --all
git commit -m "Initial commit"
fi
}
initialize_node_project
install_tailwindcss
install_prettier
initialize_git_repository
code .