Skip to content

Commit 19f7895

Browse files
committed
Output class namespace if defined in config
1 parent 5f811a9 commit 19f7895

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ router.get('/config', (ctx) => {
1515
// delete the require cache of tailwind config so we can pick up new changes
1616
delete require.cache[tailwindConfigPath]
1717
const tailwindConfig = require(tailwindConfigPath)
18-
ctx.body = resolveConfig(tailwindConfig).theme
18+
ctx.body = resolveConfig(tailwindConfig)
1919
})
2020

2121
app

src/components/Canvas/Canvas.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ export default {
5050
Spacing
5151
},
5252
53+
provide () {
54+
return {
55+
prefixClassName: this.prefixClassName
56+
}
57+
},
58+
5359
data () {
5460
return {
5561
config: null,
@@ -58,10 +64,14 @@ export default {
5864
},
5965
6066
methods: {
61-
sectionComponent: (component) => {
67+
sectionComponent (component) {
6268
return require(`./Sections/${component}.vue`).default
6369
},
6470
71+
prefixClassName (className) {
72+
return this.config.prefix ? `${this.config.prefix}-${className}` : className
73+
},
74+
6575
fileSelected (e) {
6676
const fr = new FileReader()
6777
fr.onload = (e) => {
@@ -76,7 +86,7 @@ export default {
7686
const config = await fetch('/config')
7787
this.config = await config.json()
7888
console.log(this.config)
79-
this.configTransformed = themeComponentMapper(this.config)
89+
this.configTransformed = themeComponentMapper(this.config.theme)
8090
}
8191
}
8292
</script>

src/components/Canvas/CanvasBlockLabel.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"
1414
readonly
1515
ref="label"
16-
:value="label"
16+
:value="prefixClassName(label)"
1717
@click="copy"
1818
@mouseover="showCopy"
1919
@mouseout="hideCopy"
@@ -26,11 +26,16 @@
2626

2727
<script>
2828
export default {
29+
inject: [
30+
'prefixClassName'
31+
],
32+
2933
props: {
3034
label: {
3135
type: String,
3236
required: true
3337
},
38+
3439
value: {
3540
type: String,
3641
required: true

0 commit comments

Comments
 (0)