Skip to content

Commit e441f23

Browse files
authored
feat(create-app): add 'svelte' and 'svelte-ts' options (#2537)
1 parent c433236 commit e441f23

31 files changed

+459
-1
lines changed

packages/create-app/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Currently supported template presets include:
4343
- `preact-ts`
4444
- `lit-element`
4545
- `lit-element-ts`
46+
- `svelte`
47+
- `svelte-ts`
4648

4749
## Community Templates
4850

packages/create-app/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
cyan,
1212
magenta,
1313
lightRed,
14+
red,
1415
stripColors
1516
} = require('kolorist')
1617

@@ -25,7 +26,9 @@ const TEMPLATES = [
2526
magenta('preact'),
2627
magenta('preact-ts'),
2728
lightRed('lit-element'),
28-
lightRed('lit-element-ts')
29+
lightRed('lit-element-ts'),
30+
red('svelte'),
31+
red('svelte-ts')
2932
]
3033

3134
const renameFiles = {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["svelte.svelte-vscode"]
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Svelte + TS + Vite
2+
3+
This template should help get you started developing with Svelte and TypeScript in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
8+
9+
## Need an official Svelte framework?
10+
11+
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules/
2+
/dist/
3+
/.vscode/
4+
.DS_Store
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="svelte" />
2+
/// <reference types="vite/client" />
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Svelte + TS + Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "vite-svelte-ts-starter",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vite build",
7+
"serve": "vite preview"
8+
},
9+
"devDependencies": {
10+
"@svitejs/vite-plugin-svelte": "^0.11.1",
11+
"svelte": "^3.35.0",
12+
"svelte-preprocess": "^4.6.9",
13+
"typescript": "^4.2.3",
14+
"vite": "^2.1.0"
15+
}
16+
}
1.12 KB
Binary file not shown.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<script lang="ts">
2+
import logo from './assets/svelte.png'
3+
import Counter from './lib/Counter.svelte'
4+
</script>
5+
6+
<main>
7+
<img src={logo} alt="Svelte Logo" />
8+
<h1>Hello Typescript!</h1>
9+
10+
<Counter id="0" />
11+
12+
<p>
13+
Visit <a href="https://svelte.dev">svelte.dev</a> to learn how to build Svelte
14+
apps.
15+
</p>
16+
17+
<p>
18+
Check out <a href="https://github.com/sveltejs/kit#readme">SvelteKit</a> for
19+
the officially supported framework, also powered by Vite!
20+
</p>
21+
</main>
22+
23+
<style>
24+
:root {
25+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
26+
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
27+
}
28+
29+
main {
30+
text-align: center;
31+
padding: 1em;
32+
margin: 0 auto;
33+
}
34+
35+
img {
36+
height: 16rem;
37+
width: 16rem;
38+
}
39+
40+
h1 {
41+
color: #ff3e00;
42+
text-transform: uppercase;
43+
font-size: 4rem;
44+
font-weight: 100;
45+
line-height: 1.1;
46+
margin: 2rem auto;
47+
max-width: 14rem;
48+
}
49+
50+
p {
51+
max-width: 14rem;
52+
margin: 1rem auto;
53+
line-height: 1.35;
54+
}
55+
56+
@media (min-width: 480px) {
57+
h1 {
58+
max-width: none;
59+
}
60+
61+
p {
62+
max-width: none;
63+
}
64+
}
65+
</style>

0 commit comments

Comments
 (0)