├── .eslintrc.json ├── .gitignore ├── README.md ├── package.json ├── public └── index.html ├── src ├── App.svelte ├── main.js ├── router.js └── views │ ├── Hello.svelte │ ├── Index.svelte │ └── Something.svelte └── webpack.config.js /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | "extends": "standard", 7 | "parser": "babel-eslint", 8 | "globals": { 9 | "Atomics": "readonly", 10 | "SharedArrayBuffer": "readonly" 11 | }, 12 | "parserOptions": { 13 | "ecmaVersion": 2018, 14 | "sourceType": "module" 15 | }, 16 | "plugins": ["svelte3"], 17 | "rules": { 18 | "import/first": false 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | package-lock.json 4 | yarn.lock 5 | dist -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # svelte app 2 | 3 | This is a project template for [Svelte](https://svelte.technology) apps with routing and lazy-loading. 4 | 5 | To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit): 6 | 7 | ```bash 8 | npx degit OrdinaryJellyfish/svelte-routing-template svelte-app 9 | cd svelte-app 10 | ``` 11 | 12 | *Note that you will need to have [Node.js](https://nodejs.org) installed.* 13 | 14 | 15 | ## Get started 16 | 17 | Install the dependencies... 18 | 19 | ```bash 20 | cd svelte-app 21 | npm install 22 | ``` 23 | 24 | ...then start webpack: 25 | 26 | ```bash 27 | npm run dev 28 | ``` 29 | 30 | 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. 31 | 32 | 33 | ## Deploying to the web 34 | 35 | ### With [now](https://zeit.co/now) 36 | 37 | Install `now` if you haven't already: 38 | 39 | ```bash 40 | npm install -g now 41 | ``` 42 | 43 | Then, from within your project folder: 44 | 45 | ```bash 46 | now 47 | ``` 48 | 49 | As an alternative, use the [Now desktop client](https://zeit.co/download) and simply drag the unzipped project folder to the taskbar icon. 50 | 51 | ### With [surge](https://surge.sh/) 52 | 53 | Install `surge` if you haven't already: 54 | 55 | ```bash 56 | npm install -g surge 57 | ``` 58 | 59 | Then, from within your project folder: 60 | 61 | ```bash 62 | npm run build 63 | surge public 64 | ``` 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-app", 3 | "version": "1.0.0", 4 | "devDependencies": { 5 | "@vue/preload-webpack-plugin": "^1.1.0", 6 | "babel-eslint": "^10.0.1", 7 | "cross-env": "^5.2.0", 8 | "css-loader": "^2.1.1", 9 | "eslint": "^5.16.0", 10 | "eslint-config-standard": "^12.0.0", 11 | "eslint-plugin-import": "^2.17.2", 12 | "eslint-plugin-node": "^8.0.1", 13 | "eslint-plugin-promise": "^4.1.1", 14 | "eslint-plugin-standard": "^4.0.0", 15 | "html-webpack-plugin": "^3.2.0", 16 | "mini-css-extract-plugin": "^0.6.0", 17 | "page": "^1.11.4", 18 | "serve": "^11.0.0", 19 | "style-loader": "^0.23.1", 20 | "svelte": "^3.0.0", 21 | "svelte-loader": "2.13.3", 22 | "webpack": "^4.30.0", 23 | "webpack-cli": "^3.3.0", 24 | "webpack-dev-server": "^3.3.1" 25 | }, 26 | "scripts": { 27 | "build": "cross-env NODE_ENV=production webpack", 28 | "dev": "webpack-dev-server --content-base public --history-api-fallback", 29 | "lint": "eslint . --ext .js,.svelte", 30 | "fix": "eslint . --ext .js,.svelte --fix" 31 | }, 32 | "dependencies": { 33 | "eslint-plugin-svelte3": "^1.0.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |