Skip to content

Commit 2ce2b5f

Browse files
committed
feat: 引入 postcss-nested
1 parent 5c2e46b commit 2ce2b5f

File tree

27 files changed

+165
-274
lines changed

27 files changed

+165
-274
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"plop": "^4.0.1",
7474
"postcss": "^8.4.40",
7575
"postcss-html": "^1.7.0",
76+
"postcss-nested": "^6.2.0",
7677
"sass": "^1.77.8",
7778
"simple-git-hooks": "^2.11.1",
7879
"stylelint": "^16.8.1",

plop-templates/component/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ defineOptions({
1212
</div>
1313
</template>
1414

15-
<style lang="scss" scoped>
16-
// 样式
15+
<style scoped>
16+
/* 样式 */
1717
</style>

plop-templates/page/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ defineOptions({
1010
</div>
1111
</template>
1212

13-
<style lang="scss" scoped>
14-
// 样式
13+
<style scoped>
14+
/* 样式 */
1515
</style>

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postcss.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export default {
22
plugins: {
3-
autoprefixer: {},
3+
'autoprefixer': {},
4+
'postcss-nested': {},
45
},
56
}

src/assets/styles/globals.scss renamed to src/assets/styles/globals.css

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
// 页面布局 CSS 变量
1+
/* 页面布局 CSS 变量 */
22
:root {
3-
// 头部高度
3+
/* 头部高度 */
44
--g-header-height: 60px;
5-
// 侧边栏宽度
5+
6+
/* 侧边栏宽度 */
67
--g-main-sidebar-width: 80px;
78
--g-sub-sidebar-width: 220px;
89
--g-sub-sidebar-collapse-width: 64px;
9-
// 侧边栏Logo高度
10+
11+
/* 侧边栏Logo高度 */
1012
--g-sidebar-logo-height: 50px;
11-
// 顶栏高度
13+
14+
/* 顶栏高度 */
1215
--g-topbar-height: 50px;
13-
// 窗口高度(仅在窗口预览时使用)
16+
17+
/* 窗口高度(仅在窗口预览时使用) */
1418
--g-window-height: 800px;
15-
// 窗口预览缩放系数
19+
20+
/* 窗口预览缩放系数 */
1621
--g-window-perview-scale: 0.5;
1722
}
1823

19-
// 明暗模式 CSS 变量
24+
/* 明暗模式 CSS 变量 */
2025
/* stylelint-disable-next-line no-duplicate-selectors */
2126
:root {
2227
--g-box-shadow-color: rgb(0 0 0 / 12%);
@@ -89,7 +94,7 @@ body {
8994
box-sizing: inherit;
9095
}
9196

92-
// 右侧内容区针对fixed元素,有横向铺满的需求,可在fixed元素上设置 [data-fixed-calc-width]
97+
/* 右侧内容区针对fixed元素,有横向铺满的需求,可在fixed元素上设置 [data-fixed-calc-width] */
9398
[data-fixed-calc-width] {
9499
position: fixed;
95100
right: 0;
@@ -98,20 +103,20 @@ body {
98103
transform: translateX(-50%) translateX(calc(var(--g-main-sidebar-actual-width) / 2)) translateX(calc(var(--g-sub-sidebar-actual-width) / 2));
99104
}
100105

101-
// textarea 字体跟随系统
106+
/* textarea 字体跟随系统 */
102107
textarea {
103108
font-family: inherit;
104109
}
105110

106111
/* Overrides Floating Vue */
107112
.v-popper--theme-dropdown,
108113
.v-popper--theme-tooltip {
109-
--at-apply: inline-flex;
114+
--uno: inline-flex;
110115
}
111116

112117
.v-popper--theme-dropdown .v-popper__inner,
113118
.v-popper--theme-tooltip .v-popper__inner {
114-
--at-apply: bg-white dark-bg-stone-8 text-dark dark-text-white rounded shadow ring-1 ring-gray-200 dark-ring-gray-800 border border-solid border-stone/20 text-xs font-normal;
119+
--uno: bg-white dark-bg-stone-8 text-dark dark-text-white rounded shadow ring-1 ring-gray-200 dark-ring-gray-800 border border-solid border-stone/20 text-xs font-normal;
115120

116121
box-shadow: 0 6px 30px rgb(0 0 0 / 10%);
117122
}
@@ -120,12 +125,12 @@ textarea {
120125
.v-popper--theme-dropdown .v-popper__arrow-inner {
121126
visibility: visible;
122127

123-
--at-apply: border-white dark-border-stone-8;
128+
--uno: border-white dark-border-stone-8;
124129
}
125130

126131
.v-popper--theme-tooltip .v-popper__arrow-outer,
127132
.v-popper--theme-dropdown .v-popper__arrow-outer {
128-
--at-apply: border-stone/20;
133+
--uno: border-stone/20;
129134
}
130135

131136
.v-popper--theme-tooltip.v-popper--shown,

src/components/FileUpload/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const onPreview: UploadProps['onPreview'] = (e) => {
114114
</ElUpload>
115115
</template>
116116

117-
<style lang="scss" scoped>
117+
<style scoped>
118118
:deep(.el-upload.is-drag) {
119119
display: inline-block;
120120

src/components/ImagePreview/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const realHeight = computed(() => {
3434
</ElImage>
3535
</template>
3636

37-
<style lang="scss" scoped>
37+
<style scoped>
3838
.el-image {
3939
background-color: var(--el-fill-color);
4040
border-radius: 5px;

src/components/ImageUpload/index.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
136136
</div>
137137
</template>
138138

139-
<style lang="scss" scoped>
139+
<style scoped>
140140
.upload-container {
141141
line-height: initial;
142142
}
@@ -160,14 +160,16 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
160160
transition: opacity 0.3s;
161161
162162
.actions {
163+
position: absolute;
164+
top: 50%;
165+
left: 50%;
163166
display: flex;
164167
flex-wrap: wrap;
165168
align-items: center;
166169
justify-content: center;
167170
width: 100px;
168171
height: 100px;
169-
170-
@include position-center(xy);
172+
transform: translateX(-50%) translateY(-50%);
171173
172174
span {
173175
width: 50%;
@@ -235,9 +237,11 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
235237
}
236238
237239
.el-progress {
240+
position: absolute;
241+
top: 50%;
242+
left: 50%;
238243
z-index: 1;
239-
240-
@include position-center(xy);
244+
transform: translateX(-50%) translateY(-50%);
241245
242246
.el-progress__text {
243247
color: var(--el-text-color-placeholder);

src/components/ImagesUpload/index.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
153153
</div>
154154
</template>
155155

156-
<style lang="scss" scoped>
156+
<style scoped>
157157
.upload-container {
158158
line-height: initial;
159159
}
@@ -180,14 +180,16 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
180180
transition: opacity 0.3s;
181181
182182
.actions {
183+
position: absolute;
184+
top: 50%;
185+
left: 50%;
183186
display: flex;
184187
flex-wrap: wrap;
185188
align-items: center;
186189
justify-content: center;
187190
width: 100px;
188191
height: 100px;
189-
190-
@include position-center(xy);
192+
transform: translateX(-50%) translateY(-50%);
191193
192194
span {
193195
width: 50%;
@@ -260,9 +262,11 @@ const onSuccess: UploadProps['onSuccess'] = (res) => {
260262
}
261263
262264
.el-progress {
265+
position: absolute;
266+
top: 50%;
267+
left: 50%;
263268
z-index: 1;
264-
265-
@include position-center(xy);
269+
transform: translateX(-50%) translateY(-50%);
266270
267271
.el-progress__text {
268272
color: var(--el-text-color-placeholder);

0 commit comments

Comments
 (0)