Skip to content

Commit 56413b8

Browse files
committed
chore: temp commit
1 parent a029f53 commit 56413b8

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

packages/core/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const unplugin = createUnplugin<Options>(
5353
name: `${NAME}:inject`,
5454
enforce: 'post',
5555
async transform(code: string, id: string) {
56-
debugger
5756
// ⭐TODO: 只支持 .vue ? jsx, tsx, js, ts ?
5857
try {
5958
// transform in dev
@@ -67,11 +66,11 @@ const unplugin = createUnplugin<Options>(
6766
code = injectCssOnServer(code, vbindVariableList)
6867
} else {
6968
// transform in build
70-
if (id.includes('type=script') || id.endsWith('.vue')) {
69+
/*if (id.includes('type=script') || id.endsWith('.vue')) {
7170
const injectRes = injectCSSVars(code, vbindVariableList, isScriptSetup, userOptions.dev)
7271
code = injectRes.code
7372
vbindVariableList = injectRes.vbindVariableList
74-
}
73+
}*/
7574
}
7675

7776
return code

packages/core/runtime.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
在build bundle 阶段,改写 css
22
似乎不太行得通....
3-
两个文件 相同的 importer path 上,相同的样式,相同的cssvars(hash 不同),會衝突
3+
4+
TODO server 時 vbindVariableList 要按照組件存儲,避免後面你的覆蓋卡面的
5+
6+
方案一 打包時,每個組件路徑存一份样式文件,修改哈希, 參與css編譯
7+
方案二 打包时,在transform 的 pre, 将每个零组件路径的样式进行提升注入,并抹除importer,参与vue编译

play/src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default defineComponent({
7373

7474
<template>
7575
<div class="scss" @click="sassColor = 'red'">
76-
TEST
76+
app
7777
<Comp />
7878
</div>
7979
</template>
@@ -87,4 +87,5 @@ div {
8787
color: v-bind(color)
8888
}
8989
@import './assets/scss/foo.scss';
90+
@import './assets/scss/bar.scss';
9091
</style>

play/src/comp.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { reactive, ref } from 'vue'
33
const compAsd = () => 'red'
4+
const color = 'yellow'
45
const compTheme1 = compAsd()
56
const compTheme2 = 'red'
67
const sassColor = 'pink'
@@ -12,7 +13,7 @@ const compTheme6 = () => 'red'
1213

1314
<template>
1415
<div class="test">
15-
TEST
16+
comp
1617
</div>
1718
</template>
1819

@@ -21,5 +22,9 @@ const compTheme6 = () => 'red'
2122
div {
2223
color: v-bind(color)
2324
}
24-
@import './assets/scss/bar.scss';
25+
// @import './assets/scss/bar.scss';
26+
.blue-btn {
27+
28+
color: v-bind(sassColor);
29+
}
2530
</style>

0 commit comments

Comments
 (0)