This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Billy Clark
committed
Jul 15, 2019
1 parent
7febd27
commit 87681cf
Showing
9 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
node_modules | ||
public/bundle.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
*Psst — looking for a shareable component template? Go here --> [sveltejs/component-template](https://github.com/sveltejs/component-template)* | ||
|
||
--- | ||
|
||
# svelte app | ||
|
||
This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template. | ||
|
||
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit): | ||
|
||
```bash | ||
npx degit sveltejs/template svelte-app | ||
cd svelte-app | ||
``` | ||
|
||
*Note that you will need to have [Node.js](https://nodejs.org) installed.* | ||
|
||
|
||
## Get started | ||
|
||
Install the dependencies... | ||
|
||
```bash | ||
cd svelte-app | ||
npm install | ||
``` | ||
|
||
...then start [Rollup](https://rollupjs.org): | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
Navigate to [localhost:5000](http://localhost:5000). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes. | ||
|
||
|
||
## Deploying to the web | ||
|
||
### With [now](https://zeit.co/now) | ||
|
||
Install `now` if you haven't already: | ||
|
||
```bash | ||
npm install -g now | ||
``` | ||
|
||
Then, from within your project folder: | ||
|
||
```bash | ||
now | ||
``` | ||
|
||
As an alternative, use the [Now desktop client](https://zeit.co/download) and simply drag the unzipped project folder to the taskbar icon. | ||
|
||
### With [surge](https://surge.sh/) | ||
|
||
Install `surge` if you haven't already: | ||
|
||
```bash | ||
npm install -g surge | ||
``` | ||
|
||
Then, from within your project folder: | ||
|
||
```bash | ||
npm run build | ||
surge public | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "svelte-app", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^1.12.0", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-livereload": "^1.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-svelte": "^5.0.3", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"svelte": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"sirv-cli": "^0.4.4" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"autobuild": "rollup -c -w", | ||
"dev": "run-p start:dev autobuild", | ||
"start": "sirv public --single", | ||
"start:dev": "sirv public --single --dev" | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
html, body { | ||
position: relative; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
body { | ||
color: #333; | ||
margin: 0; | ||
padding: 8px; | ||
box-sizing: border-box; | ||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; | ||
} | ||
|
||
a { | ||
color: rgb(0,100,200); | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
a:visited { | ||
color: rgb(0,80,160); | ||
} | ||
|
||
label { | ||
display: block; | ||
} | ||
|
||
input, button, select, textarea { | ||
font-family: inherit; | ||
font-size: inherit; | ||
padding: 0.4em; | ||
margin: 0 0 0.5em 0; | ||
box-sizing: border-box; | ||
border: 1px solid #ccc; | ||
border-radius: 2px; | ||
} | ||
|
||
input:disabled { | ||
color: #ccc; | ||
} | ||
|
||
input[type="range"] { | ||
height: 0; | ||
} | ||
|
||
button { | ||
color: #333; | ||
background-color: #f4f4f4; | ||
outline: none; | ||
} | ||
|
||
button:active { | ||
background-color: #ddd; | ||
} | ||
|
||
button:focus { | ||
border-color: #666; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset='utf8'> | ||
<meta name='viewport' content='width=device-width'> | ||
|
||
<title>Svelte app</title> | ||
|
||
<link rel='icon' type='image/png' href='/favicon.png'> | ||
<link rel='stylesheet' href='/global.css'> | ||
<link rel='stylesheet' href='/bundle.css'> | ||
|
||
<script defer src='/bundle.js'></script> | ||
</head> | ||
|
||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import svelte from 'rollup-plugin-svelte'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import livereload from 'rollup-plugin-livereload'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
|
||
const production = !process.env.ROLLUP_WATCH; | ||
|
||
export default { | ||
input: 'src/main.js', | ||
output: { | ||
sourcemap: true, | ||
format: 'iife', | ||
name: 'app', | ||
file: 'public/bundle.js' | ||
}, | ||
plugins: [ | ||
svelte({ | ||
// enable run-time checks when not in production | ||
dev: !production, | ||
// we'll extract any component CSS out into | ||
// a separate file — better for performance | ||
css: css => { | ||
css.write('public/bundle.css'); | ||
} | ||
}), | ||
|
||
// If you have external dependencies installed from | ||
// npm, you'll most likely need these plugins. In | ||
// some cases you'll need additional configuration — | ||
// consult the documentation for details: | ||
// https://github.com/rollup/rollup-plugin-commonjs | ||
resolve({ | ||
browser: true, | ||
dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/') | ||
}), | ||
commonjs(), | ||
|
||
// Watch the `public` directory and refresh the | ||
// browser on changes when not in production | ||
!production && livereload('public'), | ||
|
||
// If we're building for production (npm run build | ||
// instead of npm run dev), minify | ||
production && terser() | ||
], | ||
watch: { | ||
clearScreen: false | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
export let name; | ||
</script> | ||
|
||
<style> | ||
h1 { | ||
color: purple; | ||
} | ||
</style> | ||
|
||
<h1>Hello {name}!</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import App from './App.svelte'; | ||
|
||
const app = new App({ | ||
target: document.body, | ||
props: { | ||
name: 'world' | ||
} | ||
}); | ||
|
||
export default app; |