Skip to content

Commit eb94947

Browse files
author
amandaesmith333
committed
update Vue files
1 parent 47d4f0e commit eb94947

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/components/global/Playground/stackblitz.utils.ts

+24-19
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const openReactEditor = async (code: string, options?: EditorOptions) => {
200200
}
201201

202202
const openVueEditor = async (code: string, options?: EditorOptions) => {
203-
let [package_json, package_lock_json, index_html, variables_css, vite_config_ts, main_ts, app_vue, tsconfig_json, tsconfig_node_json, env_d_ts] = await loadSourceFiles([
203+
const defaultFiles = await loadSourceFiles([
204204
'vue/package.json',
205205
'vue/package-lock.json',
206206
'vue/index.html',
@@ -213,7 +213,28 @@ const openVueEditor = async (code: string, options?: EditorOptions) => {
213213
'vue/env.d.ts'
214214
], options.version);
215215

216-
main_ts = main_ts.replace('{{ MODE }}', options?.mode);
216+
const mainTs = 'src/main.ts';
217+
const files = {
218+
'src/App.vue': defaultFiles[6],
219+
'src/components/Example.vue': code,
220+
[mainTs]: defaultFiles[5],
221+
'src/env.d.ts': defaultFiles[9],
222+
'src/theme/variables.css': defaultFiles[3],
223+
'index.html': defaultFiles[2],
224+
'vite.config.ts': defaultFiles[4],
225+
'package.json': defaultFiles[0],
226+
'package-lock.json': defaultFiles[1],
227+
'tsconfig.json': defaultFiles[7],
228+
'tsconfig.node.json': defaultFiles[8],
229+
...options?.files,
230+
'.stackblitzrc': `{
231+
"startCommand": "yarn run dev"
232+
}`
233+
};
234+
235+
files[mainTs] = files[mainTs].replace('.use(IonicVue)', `.use(IonicVue, {
236+
mode: '${options?.mode}'
237+
})`);
217238

218239
/**
219240
* We have to use Stackblitz web containers here (node template), due
@@ -225,23 +246,7 @@ const openVueEditor = async (code: string, options?: EditorOptions) => {
225246
template: 'node',
226247
title: options?.title ?? DEFAULT_EDITOR_TITLE,
227248
description: options?.description ?? DEFAULT_EDITOR_DESCRIPTION,
228-
files: {
229-
'src/App.vue': app_vue,
230-
'src/components/Example.vue': code,
231-
'src/main.ts': main_ts,
232-
'src/env.d.ts': env_d_ts,
233-
'src/theme/variables.css': variables_css,
234-
'index.html': index_html,
235-
'vite.config.ts': vite_config_ts,
236-
'package.json': package_json,
237-
'package-lock.json': package_lock_json,
238-
'tsconfig.json': tsconfig_json,
239-
'tsconfig.node.json': tsconfig_node_json,
240-
...options?.files,
241-
'.stackblitzrc': `{
242-
"startCommand": "yarn run dev"
243-
}`
244-
}
249+
files
245250
});
246251
}
247252

static/code/stackblitz/v7/vue/main.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ import '@ionic/vue/css/display.css';
2222
/* Theme variables */
2323
import './theme/variables.css';
2424

25-
createApp(App).use(IonicVue, {
26-
mode: '{{ MODE }}'
27-
}).mount('#app');
25+
createApp(App).use(IonicVue).mount('#app');

0 commit comments

Comments
 (0)