diff --git a/create/templates/core/copy-assets.js b/create/templates/core/copy-assets.js index f661dd2..64082e4 100644 --- a/create/templates/core/copy-assets.js +++ b/create/templates/core/copy-assets.js @@ -10,6 +10,7 @@ module.exports = (options) => { const { template, bundler, type } = options; const toCopy = []; const srcFolder = bundler ? 'src' : 'www'; + const fileExtension = bundler ? 'f7' : 'html'; // Copy Pages const pages = [ @@ -21,35 +22,30 @@ module.exports = (options) => { pages.forEach((p) => { const src = path.resolve(__dirname, 'pages', `${p}.html`); const dest = path.resolve(cwd, srcFolder, 'pages'); - if (bundler !== 'vite') { - toCopy.push({ - from: src, - to: path.resolve(dest, `${p}.html`), - }); - } else { - let content = fse.readFileSync(src); - if (content.trim().indexOf('\n${content.trim()}\n\n`; - } - toCopy.push({ - content, - to: path.resolve(dest, `${p}.f7`), - }); + + let content = fse.readFileSync(src); + if (content.trim().indexOf('\n${content.trim()}\n\n`; } + toCopy.push({ + content, + to: path.resolve(dest, `${p}.${fileExtension}`), + }); }); toCopy.push({ content: generateStore(options), to: path.resolve(cwd, srcFolder, 'js', 'store.js'), }); + toCopy.push({ + content: `\n`, + to: path.resolve(cwd, srcFolder, 'pages', `home.${fileExtension}`), + }); + if (bundler) { - toCopy.push({ - content: `\n`, - to: path.resolve(cwd, srcFolder, 'pages', 'home.f7'), - }); toCopy.push({ content: generateRoot(options), to: path.resolve(cwd, srcFolder, 'app.f7'), diff --git a/create/templates/core/generate-root.js b/create/templates/core/generate-root.js index d20a81c..6ba694c 100644 --- a/create/templates/core/generate-root.js +++ b/create/templates/core/generate-root.js @@ -92,13 +92,7 @@ module.exports = (options) => { if (template === 'single-view' || template === 'split-view' || template === 'blank') { views = indent(4, ` - ${templateIf(bundler === 'vite', () => `
- `, () => ` -
- ${indent(8, generateHomePage(options)).trim()} -
- `)} `); } // prettier-ignore @@ -130,15 +124,9 @@ module.exports = (options) => { - ${templateIf(bundler === 'vite', () => `
- `, () => ` -
- ${indent(8, generateHomePage(options)).trim()} -
- `)}
diff --git a/create/templates/core/generate-routes.js b/create/templates/core/generate-routes.js index 9fcd949..b7a3406 100644 --- a/create/templates/core/generate-routes.js +++ b/create/templates/core/generate-routes.js @@ -23,7 +23,7 @@ module.exports = (options) => { var routes = [ { path: '/', - url: './index.html', + componentUrl: './pages/home.html', }, ]; `); @@ -147,7 +147,7 @@ module.exports = (options) => { var routes = [ { path: '/', - url: './index.html', + componentUrl: './pages/home.html', }, { path: '/about/', diff --git a/create/templates/svelte/generate-scripts.js b/create/templates/svelte/generate-scripts.js index 6c28a98..7855b80 100644 --- a/create/templates/svelte/generate-scripts.js +++ b/create/templates/svelte/generate-scripts.js @@ -12,6 +12,7 @@ module.exports = (options) => { let scripts = ''; scripts += indent(0, ` + import { mount } from 'svelte'; // Import Framework7 import Framework7 from '${customBuild ? './framework7-custom.js' : 'framework7/lite-bundle'}'; @@ -38,9 +39,11 @@ module.exports = (options) => { Framework7.use(Framework7Svelte) // Mount Svelte App - const app = new App({ + const app = mount(App, { target: document.getElementById('app'), }); + + export default app; `); return scripts.trim();