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
0 parents
commit cc0e5b1
Showing
9 changed files
with
3,689 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,4 @@ | ||
.DS_Store | ||
node_modules | ||
public/bundle.* | ||
package-lock.json |
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,66 @@ | ||
# svelte app | ||
|
||
This is a project template for [Svelte](https://svelte.technology) apps. It lives at https://github.com/sveltejs/template-webpack. | ||
|
||
To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit): | ||
|
||
```bash | ||
npm install -g degit # you only need to do this once | ||
|
||
degit sveltejs/template-webpack 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:8080](http://localhost:8080). You should see your app running. Edit a component file in `src`, save it, and the page should reload with 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,16 @@ | ||
{ | ||
"name": "svelte-app", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"cross-env": "^5.1.1", | ||
"serve": "^6.4.1", | ||
"svelte": "^1.46.1", | ||
"svelte-loader": "^2.1.0", | ||
"webpack": "^3.10.0", | ||
"webpack-dev-server": "^2.9.7" | ||
}, | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production webpack", | ||
"dev": "webpack-dev-server" | ||
} | ||
} |
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,61 @@ | ||
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 { | ||
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,16 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset='utf8'> | ||
<meta name='viewport' content='width=device-width'> | ||
|
||
<title>Svelte app</title> | ||
|
||
<link rel='stylesheet' href='global.css'> | ||
<link rel='stylesheet' href='bundle.css'> | ||
</head> | ||
|
||
<body> | ||
<script src='bundle.js'></script> | ||
</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,7 @@ | ||
<h1>Hello {{name}}!</h1> | ||
|
||
<style> | ||
h1 { | ||
color: red; | ||
} | ||
</style> |
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,12 @@ | ||
import App from './App.html'; | ||
|
||
const app = new App({ | ||
target: document.body, | ||
data: { | ||
name: 'world' | ||
} | ||
}); | ||
|
||
window.app = app; | ||
|
||
export default app; |
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,36 @@ | ||
const { readFileSync } = require('fs'); | ||
const webpack = require('webpack'); | ||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); | ||
|
||
const prod = process.env.NODE_ENV === 'production'; | ||
|
||
module.exports = { | ||
entry: { | ||
bundle: ['./src/main.js'] | ||
}, | ||
resolve: { | ||
extensions: ['.js', '.html'] | ||
}, | ||
output: { | ||
path: __dirname + '/public', | ||
filename: '[name].js', | ||
chunkFilename: '[name].[id].js' | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.html$/, | ||
exclude: /node_modules/, | ||
use: 'svelte-loader' | ||
} | ||
] | ||
}, | ||
plugins: prod ? [ | ||
new webpack.optimize.ModuleConcatenationPlugin(), | ||
new UglifyJSPlugin() | ||
] : [], | ||
devServer: { | ||
contentBase: './public' | ||
}, | ||
devtool: prod ? false : 'inline-source-map' | ||
}; |
Oops, something went wrong.