commit 600360665d1bd74f0bc4441363b498dee1f078e5 Author: Rich Harris Date: Sun Dec 17 14:47:18 2017 -0500 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f621bbb --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +node_modules +.sapper +templates/.* +yarn.lock \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..40bc4c2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) 2017 [these people](https://github.com/sveltejs/sapper/graphs/contributors) + +Permission is hereby granted by the authors of this software, to any person, to use the software for any purpose, free of charge, including the rights to run, read, copy, change, distribute and sell it, and including usage rights to any patents the authors may hold on it, subject to the following conditions: + +This license, or a link to its text, must be included with all copies of the software and any derivative works. + +Any modification to the software submitted to the authors may be incorporated into the software under the terms of this license. + +The software is provided "as is", without warranty of any kind, including but not limited to the warranties of title, fitness, merchantability and non-infringement. The authors have no obligation to provide support or updates for the software, and may not be held liable for any damages, claims or other liability arising from its use. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5a00b81 --- /dev/null +++ b/README.md @@ -0,0 +1,81 @@ +# sapper-template + +The default [Sapper](https://github.com/sveltejs/sapper) template. To clone it and get started: + +```bash +npx degit sveltejs/sapper-template my-app +cd my-app +npm install # or yarn! +npm run dev +``` + +Open up [localhost:3000](https://localhost:3000) and start clicking around. + + +## Structure + +Sapper expects to find three directories in the root of your project — `assets`, `routes` and `templates`. + + +### assets + +The [assets](assets) directory contains any static assets that should be available. These are served using [serve-static](https://github.com/expressjs/serve-static). + +In your [service-worker.js](templates/service-worker.js) file, Sapper makes these files available as `__assets__` so that you can cache them (though you can choose not to, for example if you don't want to cache very large files). + + +### routes + +This is the heart of your Sapper app. There are two kinds of routes — *pages*, and *server routes*. + +**Pages** are Svelte components written in `.html` files. When a user first visits the application, they will be served a server-rendered version of the route in question, plus some JavaScript that 'hydrates' the page and initialises a client-side router. From that point forward, navigating to other pages is handled entirely on the client for a fast, app-like feel. (Sapper will preload and cache the code for these subsequent pages, so that navigation is instantaneous.) + +**Server routes** are modules written in `.js` files, that export functions corresponding to HTTP methods. Each function receives Express `request` and `response` objects as arguments, plus a `next` function. This is useful for creating a JSON API, for example. + +There are three simple rules for naming the files that define your routes: + +* A file called `routes/about.html` corresponds to the `/about` route. A file called `routes/blog/[slug].html` corresponds to the `/blog/:slug` route, in which case `params.slug` is available to the route +* The file `routes/index.html` (or `routes/index.js`) corresponds to the root of your app. `routes/about/index.html` is treated the same as `routes/about.html`. +* Files and directories with a leading underscore do *not* create routes. This allows you to colocate helper modules and components with the routes that depend on them — for example you could have a file called `routes/_helpers/datetime.js` and it would *not* create a `/_helpers/datetime` route + + +### templates + +This directory should contain the following files at a minimum: + +* [2xx.html](templates/2xx.html) — a template for the page to serve for valid requests +* [4xx.html](templates/4xx.html) — a template for 4xx-range errors (such as 404 Not Found) +* [5xx.html](templates/5xx.html) — a template for 5xx-range errors (such as 500 Internal Server Error) +* [main.js](templates/main.js) — this module initialises Sapper +* [service-worker.js](templates/service-worker.js) — your app's service worker + +Inside the HTML templates, Sapper will inject various values as indicated by `%sapper.xxxx%` tags. Inside JavaScript files, Sapper will replace strings like `__dev__` with the appropriate value. + +In lieu of documentation (bear with us), consult the files to see what variables are available and how they're used. + + +## Webpack config + +Sapper uses webpack to provide code-splitting, dynamic imports and hot module reloading, as well as compiling your Svelte components. As long as you don't do anything daft, you can edit the configuration files to add whatever loaders and plugins you'd like. + + +## Production mode and deployment + +To start a production version of your app, run `npm start`. This will disable hot module replacement, and activate the appropriate webpack plugins. + +You can deploy your application to any environment that supports Node 8 or above. As an example, to deploy to [Now](https://zeit.co/now), run these commands: + +```bash +npm install -g now +now +``` + + +## Bugs and feedback + +Sapper is in early development, and may have the odd rough edge here and there. Please be vocal over on the [Sapper issue tracker](https://github.com/sveltejs/sapper/issues). + + +## License + +[LIL](LICENSE) \ No newline at end of file diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..f76753e Binary files /dev/null and b/assets/favicon.png differ diff --git a/assets/global.css b/assets/global.css new file mode 100644 index 0000000..3831b79 --- /dev/null +++ b/assets/global.css @@ -0,0 +1,45 @@ +body { + margin: 0; + font-family: Roboto, -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + font-size: 14px; + line-height: 1.5; + color: #333; +} + +main { + position: relative; + max-width: 56em; + background-color: white; + padding: 2em; + margin: 0 auto; + box-sizing: border-box; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0 0 0.5em 0; + font-weight: 400; + line-height: 1.2; +} + +h1 { + font-size: 2em; +} + +a { + color: inherit; +} + +code { + font-family: menlo, inconsolata, monospace; + font-size: calc(1em - 2px); + color: #555; + background-color: #f0f0f0; + padding: 0.2em 0.4em; + border-radius: 2px; +} + +@media (min-width: 400px) { + body { + font-size: 16px; + } +} \ No newline at end of file diff --git a/assets/great-success.png b/assets/great-success.png new file mode 100644 index 0000000..c38720c Binary files /dev/null and b/assets/great-success.png differ diff --git a/assets/manifest.json b/assets/manifest.json new file mode 100644 index 0000000..2b4ac3e --- /dev/null +++ b/assets/manifest.json @@ -0,0 +1,20 @@ +{ + "background_color": "#ffffff", + "theme_color": "#aa1e1e", + "name": "TODO", + "short_name": "TODO", + "display": "minimal-ui", + "start_url": "/", + "icons": [ + { + "src": "svelte-logo-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "svelte-logo-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/assets/svelte-logo-192.png b/assets/svelte-logo-192.png new file mode 100644 index 0000000..d12fc1a Binary files /dev/null and b/assets/svelte-logo-192.png differ diff --git a/assets/svelte-logo-512.png b/assets/svelte-logo-512.png new file mode 100644 index 0000000..37e8198 Binary files /dev/null and b/assets/svelte-logo-512.png differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..450a9eb --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "TODO", + "description": "TODO", + "version": "0.0.1", + "scripts": { + "dev": "node server.js", + "start": "cross-env NODE_ENV=production node server.js" + }, + "dependencies": { + "compression": "^1.7.1", + "cross-env": "^5.1.1", + "css-loader": "^0.28.7", + "express": "^4.16.2", + "extract-text-webpack-plugin": "^3.0.2", + "glob": "^7.1.2", + "marked": "^0.3.7", + "node-fetch": "^1.7.3", + "sapper": "^0.0.22", + "serve-static": "^1.13.1", + "style-loader": "^0.19.0", + "svelte": "^1.49.1", + "svelte-loader": "^2.2.1", + "uglifyjs-webpack-plugin": "^1.1.2" + } +} diff --git a/routes/_components/Layout.html b/routes/_components/Layout.html new file mode 100644 index 0000000..64ac22e --- /dev/null +++ b/routes/_components/Layout.html @@ -0,0 +1,15 @@ +