Skip to content

Commit fb0bed2

Browse files
committed
init
0 parents  commit fb0bed2

File tree

116 files changed

+11559
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+11559
-0
lines changed

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
2+
3+
root = true
4+
5+
[*]
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.fleet
2+
.vscode
3+
.idea
4+
5+
dist
6+
node_modules
7+
8+
references
9+
playground/**/*.epub

.markdownlint.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"no-inline-html": false
3+
}

docs/01-inspiration-and-trade-off.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# 灵感
2+
3+
使用tailwindcss来定义一套CSS代码,可以高效地模仿轻小说中标题图HTML页面的制作。
4+
5+
![](./assets/Snipaste_2022-09-26_14-14-43.png)
6+
7+
## 技术权衡
8+
9+
- Vue/Angular/React 组件的样式一般是class中绑定类,然后在`<style>`块书写对应的样式;或者直接写内联style。
10+
- Tailwindcss 可以看作一个巨大的原子类,类似一个 utility.scss,里面定义了非常多的工具类css selector样式,只需要在html中自由组合。
11+
- 弊端:导致html中css class非常多。可能会造成代码可读性下降。
12+
- 适用于强规范的项目,否则这种约束名存实亡。
13+
- 适用于书写库/框架类CSS项目,不太适合写业务界面。
14+
15+
Tailwindcss本质是将css样式,用css 类完全定义一次,后面就只是组合使用。
16+
Tailwindcss不会有button这种类名,而是一堆小的utility类名,例如`text-lg`
17+
18+
从抽象级别/粒度方面思考:
19+
20+
- 传统的UI框架提供的一般是组件级别的抽象,Tailwindcss提供的是更细粒度的样式抽象。
21+
- 对于需要高度定制的样式,使用Tailwindcss更加合适。对于不需要经常变化的样式,可以使用组件级别的传统UI框架。
22+
23+
Tailwindcss的弊端,没法类似Vue组件那样,提供强有力的行为定义,这个是JS的强项。纯CSS基本没法实现,或者会实现地非常吃力。
24+
25+
边缘场景:假如有一个button用了100遍(这个button含有很多工具class),后来需要修改了,使用Tailwindcss的话需要逐个去修改Tailwindcss的样式。
26+
27+
这就是组件化和更细粒度抽象级别之间的权衡。定制的灵活度和抽象级别之间,全都要是不可能的。

0 commit comments

Comments
 (0)