Skip to content

Commit 99c2c7b

Browse files
feat: tailwind support
1 parent 089ab40 commit 99c2c7b

File tree

8 files changed

+953
-73
lines changed

8 files changed

+953
-73
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This is a project template for [Svelte](https://svelte.dev) apps.
55
### Featuring
66
- [Svelte](https://svelte.dev/)
77
- [Typescript](https://www.typescriptlang.org/)
8+
- [Tailwind](https://tailwindcss.com/)
89
- [Jest](https://jestjs.io/)
910
- [Svelte Testing Library](https://testing-library.com/docs/svelte-testing-library/intro/)
1011
- [Eslint](https://eslint.org/)

package.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"build": "yarn pre-build && rollup -c",
6+
"build": "yarn pre-build && npm run build:tailwind && rollup -c",
77
"pre-build": "yarn coverage && yarn check",
8-
"dev": "rollup -c -w",
8+
"watch:tailwind": "postcss public/global-tailwind.css -o public/global.css -w",
9+
"build:tailwind": "cross-env NODE_ENV=production postcss public/global-tailwind.css -o public/global.css",
10+
"dev": "concurrently \"rollup -c -w\" \"npm run watch:tailwind\"",
911
"start": "sirv public --no-clear",
1012
"check": "svelte-check --tsconfig ./tsconfig.json",
1113
"test": "jest --passWithNoTests",
@@ -26,7 +28,10 @@
2628
"@types/jest": "^27.5.1",
2729
"@typescript-eslint/eslint-plugin": "^5.25.0",
2830
"@typescript-eslint/parser": "^5.25.0",
31+
"autoprefixer": "^10.4.7",
2932
"babel-jest": "^28.1.0",
33+
"concurrently": "^7.2.0",
34+
"cross-env": "^7.0.3",
3035
"eslint": "^8.16.0",
3136
"eslint-config-prettier": "^8.5.0",
3237
"eslint-plugin-import": "^2.26.0",
@@ -35,6 +40,8 @@
3540
"jest-circus": "^28.1.0",
3641
"jest-environment-jsdom": "^28.1.0",
3742
"jsdom": "^19.0.0",
43+
"postcss": "^8.4.14",
44+
"postcss-cli": "^9.1.0",
3845
"prettier": "^2.6.2",
3946
"prettier-plugin-svelte": "^2.7.0",
4047
"rollup": "^2.3.4",
@@ -46,6 +53,7 @@
4653
"svelte-check": "^2.7.1",
4754
"svelte-jester": "^2.3.2",
4855
"svelte-preprocess": "^4.0.0",
56+
"tailwindcss": "^3.0.24",
4957
"tslib": "^2.0.0",
5058
"typescript": "^4.0.0"
5159
},

postcss.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: [require('tailwindcss'), require('autoprefixer')],
3+
};

public/global-tailwind.css

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
html,
6+
body {
7+
position: relative;
8+
width: 100%;
9+
height: 100%;
10+
}
11+
12+
body {
13+
color: #333;
14+
margin: 0;
15+
padding: 8px;
16+
box-sizing: border-box;
17+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell,
18+
'Helvetica Neue', sans-serif;
19+
}
20+
21+
a {
22+
color: rgb(0, 100, 200);
23+
text-decoration: none;
24+
}
25+
26+
a:hover {
27+
text-decoration: underline;
28+
}
29+
30+
a:visited {
31+
color: rgb(0, 80, 160);
32+
}
33+
34+
label {
35+
display: block;
36+
}
37+
38+
input,
39+
button,
40+
select,
41+
textarea {
42+
font-family: inherit;
43+
font-size: inherit;
44+
-webkit-padding: 0.4em 0;
45+
padding: 0.4em;
46+
margin: 0 0 0.5em 0;
47+
box-sizing: border-box;
48+
border: 1px solid #ccc;
49+
border-radius: 2px;
50+
}
51+
52+
input:disabled {
53+
color: #ccc;
54+
}
55+
56+
button {
57+
color: #333;
58+
background-color: #f4f4f4;
59+
outline: none;
60+
}
61+
62+
button:disabled {
63+
color: #999;
64+
}
65+
66+
button:not(:disabled):active {
67+
background-color: #ddd;
68+
}
69+
70+
button:focus {
71+
border-color: #666;
72+
}

0 commit comments

Comments
 (0)