Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49fba8b

Browse files
committed
Add bash script to configure CRA with tailwindcss
0 parents commit 49fba8b

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

‎run.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
if ! command -v jq
2+
then
3+
echo "jq is required to be installed for this script"
4+
exit
5+
fi
6+
7+
if ! command -v npx
8+
then
9+
echo "npx is required to be installed for this script"
10+
exit
11+
fi
12+
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"
20+
npx create-react-app 1ドル
21+
cd 1ドル
22+
yarn add tailwindcss --dev
23+
npx tailwind init tailwind.js --full
24+
yarn add postcss-cli autoprefixer --dev
25+
26+
cat <<EOT >> postcss.config.js
27+
const tailwindcss = require('tailwindcss');
28+
module.exports = {
29+
plugins: [
30+
tailwindcss('./tailwind.js'),
31+
require('autoprefixer'),
32+
],
33+
};
34+
EOT
35+
36+
mkdir src/styles
37+
38+
cat <<EOT > src/styles/index.css
39+
@tailwind base;
40+
@tailwind components;
41+
@tailwind utilities;
42+
EOT
43+
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+
"start": "npm run build:style && react-scripts start",
50+
"build": "react-scripts build",
51+
"test": "react-scripts test",
52+
"eject": "react-scripts eject"
53+
}' package.json > package.json.temp
54+
mv package.json.temp package.json
55+
56+
rm -rf src/index.css
57+
rm -rf src/App.css
58+
59+
sed -i 's/\.\/index.css/.\/styles\/index.css/' src/index.js
60+
sed -i '/App.css/d' src/App.js

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /