1
- if ! command -v jq
2
- then
3
- echo " jq is required to be installed for this script"
4
- exit
5
- fi
6
-
7
1
if ! command -v npx
8
2
then
9
3
echo " npx is required to be installed for this script"
10
4
exit
11
5
fi
12
6
13
- if ! command -v yarn
14
- then
15
- echo " yarn is required to be installed for this script"
16
- exit
17
- fi
18
-
19
- echo " HERE"
7
+ echo " Creating a new project using create-react-app"
20
8
npx create-react-app $1
21
9
cd $1
22
- yarn add tailwindcss --dev
23
- npx tailwind init tailwind.js --full
24
- yarn add postcss-cli autoprefixer --dev
25
10
26
- cat << EOT >> postcss.config.js
27
- const tailwindcss = require('tailwindcss');
11
+ echo " Adding tailwindcss, postcss and autoprefixer as a dependency"
12
+ npm add -D tailwindcss postcss autoprefixer
13
+ npx tailwindcss init -p
14
+
15
+ echo " Configuring valid files glob for tailwindcss.config.js"
16
+ cat << EOT > tailwind.config.js
28
17
module.exports = {
29
- plugins: [
30
- tailwindcss('./tailwind.js'),
31
- require('autoprefixer'),
32
- ],
33
- };
18
+ content: [
19
+ "./src/**/*.{js,jsx,ts,tsx}",
20
+ ],
21
+ theme: {
22
+ extend: {},
23
+ },
24
+ plugins: [],
25
+ }
34
26
EOT
35
27
36
- mkdir src/styles
37
-
38
- cat << EOT > src/styles/index.css
28
+ echo " Configuring src/index.css"
29
+ cat << EOT > src/index.css
39
30
@tailwind base;
40
31
@tailwind components;
41
32
@tailwind utilities;
42
33
EOT
43
34
44
- touch src/styles/tailwind.css
45
-
46
-
47
- jq ' .scripts={
48
- "build:style":"tailwind build src/styles/index.css -o src/styles/tailwind.css",
49
- "watch:style": "tailwind build src/styles/index.css -o src/styles/tailwind.css --watch",
50
- "start": "npm run build:style && react-scripts start",
51
- "build": "react-scripts build",
52
- "test": "react-scripts test",
53
- "eject": "react-scripts eject"
54
- }' package.json > package.json.temp
55
- mv package.json.temp package.json
56
-
57
- rm -rf src/index.css
58
- rm -rf src/App.css
59
-
60
- sed -i ' s/\.\/index.css/.\/styles\/tailwind.css/' src/index.js
61
- sed -i ' /App.css/d' src/App.js
35
+ sed -i ' ' ' s|<code>|<code className="border-2 border-indigo-500 bg-indigo-900 rounded-xl p-2">|' src/App.js
0 commit comments