Spaces:
Running
Running
npx degit sveltejs/template
Browse files- .gitignore +4 -0
- .vscode/extensions.json +3 -0
- package.json +30 -0
- public/favicon.png +0 -0
- public/global.css +63 -0
- public/index.html +18 -0
- rollup.config.js +83 -0
- src/App.svelte +30 -0
- src/global.d.ts +1 -0
- src/main.ts +10 -0
- tsconfig.json +6 -0
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/node_modules/
|
2 |
+
/public/build/
|
3 |
+
|
4 |
+
.DS_Store
|
.vscode/extensions.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"recommendations": ["svelte.svelte-vscode"]
|
3 |
+
}
|
package.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "svelte-app",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"private": true,
|
5 |
+
"scripts": {
|
6 |
+
"build": "rollup -c",
|
7 |
+
"dev": "rollup -c -w",
|
8 |
+
"start": "sirv public --no-clear",
|
9 |
+
"check": "svelte-check --tsconfig ./tsconfig.json"
|
10 |
+
},
|
11 |
+
"devDependencies": {
|
12 |
+
"@rollup/plugin-commonjs": "^17.0.0",
|
13 |
+
"@rollup/plugin-node-resolve": "^11.0.0",
|
14 |
+
"rollup": "^2.3.4",
|
15 |
+
"rollup-plugin-css-only": "^3.1.0",
|
16 |
+
"rollup-plugin-livereload": "^2.0.0",
|
17 |
+
"rollup-plugin-svelte": "^7.0.0",
|
18 |
+
"rollup-plugin-terser": "^7.0.0",
|
19 |
+
"svelte": "^3.0.0",
|
20 |
+
"svelte-check": "^2.0.0",
|
21 |
+
"svelte-preprocess": "^4.0.0",
|
22 |
+
"@rollup/plugin-typescript": "^8.0.0",
|
23 |
+
"typescript": "^4.0.0",
|
24 |
+
"tslib": "^2.0.0",
|
25 |
+
"@tsconfig/svelte": "^2.0.0"
|
26 |
+
},
|
27 |
+
"dependencies": {
|
28 |
+
"sirv-cli": "^2.0.0"
|
29 |
+
}
|
30 |
+
}
|
public/favicon.png
ADDED
public/global.css
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
html, body {
|
2 |
+
position: relative;
|
3 |
+
width: 100%;
|
4 |
+
height: 100%;
|
5 |
+
}
|
6 |
+
|
7 |
+
body {
|
8 |
+
color: #333;
|
9 |
+
margin: 0;
|
10 |
+
padding: 8px;
|
11 |
+
box-sizing: border-box;
|
12 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
13 |
+
}
|
14 |
+
|
15 |
+
a {
|
16 |
+
color: rgb(0,100,200);
|
17 |
+
text-decoration: none;
|
18 |
+
}
|
19 |
+
|
20 |
+
a:hover {
|
21 |
+
text-decoration: underline;
|
22 |
+
}
|
23 |
+
|
24 |
+
a:visited {
|
25 |
+
color: rgb(0,80,160);
|
26 |
+
}
|
27 |
+
|
28 |
+
label {
|
29 |
+
display: block;
|
30 |
+
}
|
31 |
+
|
32 |
+
input, button, select, textarea {
|
33 |
+
font-family: inherit;
|
34 |
+
font-size: inherit;
|
35 |
+
-webkit-padding: 0.4em 0;
|
36 |
+
padding: 0.4em;
|
37 |
+
margin: 0 0 0.5em 0;
|
38 |
+
box-sizing: border-box;
|
39 |
+
border: 1px solid #ccc;
|
40 |
+
border-radius: 2px;
|
41 |
+
}
|
42 |
+
|
43 |
+
input:disabled {
|
44 |
+
color: #ccc;
|
45 |
+
}
|
46 |
+
|
47 |
+
button {
|
48 |
+
color: #333;
|
49 |
+
background-color: #f4f4f4;
|
50 |
+
outline: none;
|
51 |
+
}
|
52 |
+
|
53 |
+
button:disabled {
|
54 |
+
color: #999;
|
55 |
+
}
|
56 |
+
|
57 |
+
button:not(:disabled):active {
|
58 |
+
background-color: #ddd;
|
59 |
+
}
|
60 |
+
|
61 |
+
button:focus {
|
62 |
+
border-color: #666;
|
63 |
+
}
|
public/index.html
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset='utf-8'>
|
5 |
+
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
6 |
+
|
7 |
+
<title>Svelte app</title>
|
8 |
+
|
9 |
+
<link rel='icon' type='image/png' href='/favicon.png'>
|
10 |
+
<link rel='stylesheet' href='/global.css'>
|
11 |
+
<link rel='stylesheet' href='/build/bundle.css'>
|
12 |
+
|
13 |
+
<script defer src='/build/bundle.js'></script>
|
14 |
+
</head>
|
15 |
+
|
16 |
+
<body>
|
17 |
+
</body>
|
18 |
+
</html>
|
rollup.config.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import svelte from 'rollup-plugin-svelte';
|
2 |
+
import commonjs from '@rollup/plugin-commonjs';
|
3 |
+
import resolve from '@rollup/plugin-node-resolve';
|
4 |
+
import livereload from 'rollup-plugin-livereload';
|
5 |
+
import { terser } from 'rollup-plugin-terser';
|
6 |
+
import sveltePreprocess from 'svelte-preprocess';
|
7 |
+
import typescript from '@rollup/plugin-typescript';
|
8 |
+
import css from 'rollup-plugin-css-only';
|
9 |
+
|
10 |
+
const production = !process.env.ROLLUP_WATCH;
|
11 |
+
|
12 |
+
function serve() {
|
13 |
+
let server;
|
14 |
+
|
15 |
+
function toExit() {
|
16 |
+
if (server) server.kill(0);
|
17 |
+
}
|
18 |
+
|
19 |
+
return {
|
20 |
+
writeBundle() {
|
21 |
+
if (server) return;
|
22 |
+
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
|
23 |
+
stdio: ['ignore', 'inherit', 'inherit'],
|
24 |
+
shell: true
|
25 |
+
});
|
26 |
+
|
27 |
+
process.on('SIGTERM', toExit);
|
28 |
+
process.on('exit', toExit);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
}
|
32 |
+
|
33 |
+
export default {
|
34 |
+
input: 'src/main.ts',
|
35 |
+
output: {
|
36 |
+
sourcemap: true,
|
37 |
+
format: 'iife',
|
38 |
+
name: 'app',
|
39 |
+
file: 'public/build/bundle.js'
|
40 |
+
},
|
41 |
+
plugins: [
|
42 |
+
svelte({
|
43 |
+
preprocess: sveltePreprocess({ sourceMap: !production }),
|
44 |
+
compilerOptions: {
|
45 |
+
// enable run-time checks when not in production
|
46 |
+
dev: !production
|
47 |
+
}
|
48 |
+
}),
|
49 |
+
// we'll extract any component CSS out into
|
50 |
+
// a separate file - better for performance
|
51 |
+
css({ output: 'bundle.css' }),
|
52 |
+
|
53 |
+
// If you have external dependencies installed from
|
54 |
+
// npm, you'll most likely need these plugins. In
|
55 |
+
// some cases you'll need additional configuration -
|
56 |
+
// consult the documentation for details:
|
57 |
+
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
58 |
+
resolve({
|
59 |
+
browser: true,
|
60 |
+
dedupe: ['svelte']
|
61 |
+
}),
|
62 |
+
commonjs(),
|
63 |
+
typescript({
|
64 |
+
sourceMap: !production,
|
65 |
+
inlineSources: !production
|
66 |
+
}),
|
67 |
+
|
68 |
+
// In dev mode, call `npm run start` once
|
69 |
+
// the bundle has been generated
|
70 |
+
!production && serve(),
|
71 |
+
|
72 |
+
// Watch the `public` directory and refresh the
|
73 |
+
// browser on changes when not in production
|
74 |
+
!production && livereload('public'),
|
75 |
+
|
76 |
+
// If we're building for production (npm run build
|
77 |
+
// instead of npm run dev), minify
|
78 |
+
production && terser()
|
79 |
+
],
|
80 |
+
watch: {
|
81 |
+
clearScreen: false
|
82 |
+
}
|
83 |
+
};
|
src/App.svelte
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script lang="ts">
|
2 |
+
export let name: string;
|
3 |
+
</script>
|
4 |
+
|
5 |
+
<main>
|
6 |
+
<h1>Hello {name}!</h1>
|
7 |
+
<p>Visit the <a href="https://svelte.dev/tutorial">Svelte tutorial</a> to learn how to build Svelte apps.</p>
|
8 |
+
</main>
|
9 |
+
|
10 |
+
<style>
|
11 |
+
main {
|
12 |
+
text-align: center;
|
13 |
+
padding: 1em;
|
14 |
+
max-width: 240px;
|
15 |
+
margin: 0 auto;
|
16 |
+
}
|
17 |
+
|
18 |
+
h1 {
|
19 |
+
color: #ff3e00;
|
20 |
+
text-transform: uppercase;
|
21 |
+
font-size: 4em;
|
22 |
+
font-weight: 100;
|
23 |
+
}
|
24 |
+
|
25 |
+
@media (min-width: 640px) {
|
26 |
+
main {
|
27 |
+
max-width: none;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
</style>
|
src/global.d.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
/// <reference types="svelte" />
|
src/main.ts
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import App from './App.svelte';
|
2 |
+
|
3 |
+
const app = new App({
|
4 |
+
target: document.body,
|
5 |
+
props: {
|
6 |
+
name: 'world'
|
7 |
+
}
|
8 |
+
});
|
9 |
+
|
10 |
+
export default app;
|
tsconfig.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"extends": "@tsconfig/svelte/tsconfig.json",
|
3 |
+
|
4 |
+
"include": ["src/**/*"],
|
5 |
+
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
6 |
+
}
|