-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen.sh
executable file
·251 lines (231 loc) · 6.76 KB
/
gen.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#! /bin/sh
set -e
makedir() {
mkdir -p src/assets/css
mkdir -p src/layouts
mkdir -p src/middleware
mkdir -p src/pages
mkdir -p src/plugins
mkdir -p public/static
mkdir -p src/store
echo 'make nuxt style dir(s) done'
}
writefile() {
echo >postcss.config.js 'module.exports = {
plugins: [
// require("postcss-import"),
require("tailwindcss"),
// require("postcss-nested"),
// require("postcss-nesting"),
require("autoprefixer"),
],
};
'
echo 'generate postcss.config.js done'
yarn run tailwind init tailwind.base.js --full
echo 'init postcss.base.js done, use offcial templete to extand propety'
echo >tailwind.config.js 'const colors = require("tailwindcss/colors");
module.exports = {
// mode: "jit",
purge: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"], // Modify to match the framework file structure (eg. nuxt is not the same as vite )
darkMode: false, // or "media" or "class"
theme: {
extend: {
colors: {
transparent: "transparent",
current: "currentColor",
white: colors.white,
black: colors.black,
blueGray: colors.blueGray,
coolGray: colors.coolGray,
gray: colors.gray,
trueGray: colors.trueGray,
warmGray: colors.warmGray,
red: colors.red,
orange: colors.orange,
amber: colors.amber,
yellow: colors.yellow,
lime: colors.lime,
green: colors.green,
emerald: colors.emerald,
teal: colors.teal,
cyan: colors.cyan,
sky: colors.sky,
blue: colors.blue,
indigo: colors.indigo,
violet: colors.violet,
purple: colors.purple,
fuchsia: colors.fuchsia,
pink: colors.pink,
rose: colors.rose,
},
screens: {
"720p": "720px",
"980p": "980px",
"1080p": "1080px",
"1440p": "1440px",
},
maxWidth: {
"1/4": "25%",
"1/2": "50%",
"3/4": "75%",
},
minWidth: (theme, { breakpoints }) => ({
"1/4": "25%",
"1/2": "50%",
"3/4": "75%",
...breakpoints(theme("screens")),
}),
// fontSize: {
// "px-0": "0rem",
// "px-1": "0.125rem",
// "px-2": "0.313rem",
// "px-3": "0.188rem",
// "px-4": "0.25rem",
// "px-5": "0.313rem",
// "px-6": "0.375rem",
// "px-7": "0.438rem",
// "px-8": "0.5rem",
// "px-9": "0.563rem",
// "px-10": "0.625rem",
// "px-11": "0.6875rem",
// "px-12": "0.75rem",
// "px-13": "0.8125rem",
// "px-14": "0.875rem",
// "px-15": "0.9375rem",
// "px-16": "1rem",
// "px-17": "1.0625rem",
// "px-18": "1.125rem",
// "px-19": "1.1875rem",
// "px-20": "1.25rem",
// "px-21": "1.3125rem",
// "px-22": "1.375rem",
// "px-23": "1.4375rem",
// "px-24": "1.5rem",
// "px-25": "1.5625rem",
// "px-26": "1.625rem",
// "px-27": "1.6875rem",
// "px-28": "1.75rem",
// "px-29": "1.8125rem",
// "px-30": "1.875rem",
// "px-31": "1.9375rem",
// "px-32": "2rem",
// "px-33": "2.0625rem",
// "px-34": "2.125rem",
// "px-35": "2.1875rem",
// "px-36": "2.25rem",
// "px-37": "2.3125rem",
// "px-38": "2.375rem",
// "px-39": "2.4375rem",
// "px-40": "2.5rem",
// "px-41": "2.5625rem",
// "px-42": "2.625rem",
// "px-43": "2.6875rem",
// "px-44": "2.75rem",
// "px-45": "2.8125rem",
// "px-46": "2.875rem",
// "px-47": "2.9375rem",
// "px-48": "3rem",
// "px-49": "3.0625rem",
// "px-50": "3.125rem",
// "px-51": "3.1875rem",
// "px-52": "3.25rem",
// "px-53": "3.3125rem",
// "px-54": "3.375rem",
// "px-55": "3.4375rem",
// "px-56": "3.5rem",
// "px-57": "3.5625rem",
// "px-58": "3.625rem",
// "px-59": "3.6875rem",
// "px-60": "3.75rem",
// "px-61": "3.8125rem",
// "px-62": "3.875rem",
// "px-63": "3.9375rem",
// "px-64": "4rem",
// },
// fontWeight: {
// "weight-100": 100,
// "weight-200": 200,
// "weight-300": 300,
// "weight-400": 400,
// "weight-500": 500,
// "weight-600": 600,
// "weight-700": 700,
// "weight-800": 800,
// "weight-900": 900,
// },
boxShadow: {
"inner-sm": "inset 0 1px 2px 0 rgba(0, 0, 0, 0.05)",
"inner-md":
"inset 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
"inner-lg":
"inset 0 10px 15px -3px rgba(0, 0, 0, 0.1), inset 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
"inner-xl":
"inset 0 20px 25px -5px rgba(0, 0, 0, 0.1), inset 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
"inner-2xl": "inset 0 25px 50px -12px rgba(0, 0, 0, 0.25)",
"inner-3xl": "inset 0 35px 60px -15px rgba(0, 0, 0, 0.3)",
},
},
},
variants: {
extend: {
backgroundColor: ["odd", "even", "active", "group-focus", "group-hover"],
borderWidth: ["first", "last", "hover", "focus"],
cursor: ["active"],
opacity: ["disabled"],
textColor: ["group-focus", "active", "group-hover"],
ringWidth: ["focus-visible"],
ringOffsetWidth: ["focus-visible"],
ringOffsetColor: ["focus-visible"],
ringColor: ["focus-visible"],
ringOpacity: ["focus-visible"],
rotate: ["first", "last", "odd", "even"],
},
},
plugins: [],
};'
echo 'generate tailwind.config.js done'
echo >src/assets/css/tailwind.css "@tailwind base;
@tailwind components;
@tailwind utilities;"
echo 'generate tailwind.css done'
if [ -f "src/main.ts" ]; then
echo >>src/main.ts "import './assets/css/tailwind.css'"
echo 'import tailwind.css to main.ts done, change order in IDE by yourself'
fi
if [ -f "src/main.js" ]; then
echo >>src/main.js "import './assets/css/tailwind.css'"
echo 'import tailwind.css to main.js done, change order in IDE by yourself'
fi
}
adddep() {
yarn add -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
}
newvue() {
vue create $@
}
command_exists() {
command -v "$@" >/dev/null
}
main() {
if !(command_exists yarn); then
echo "This script needs yarn installed to run."
exit 1
fi
echo 'vue2 + js + tailwindcss generator (nuxt style)'
if !(command_exists vue); then
read -p 'no @vue/cli installed, any key to installing @vue/cli' a
yarn global add @vue/cli
fi
if [ $# -eq 0 ]; then
read -p '? Project name: › ' proj
else
proj=$@
fi
newvue $proj
cd ${PWD}/$proj
makedir
adddep
writefile
}
main $@