forked from gitpod-samples/template-sveltejs
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mike Nikles
authored
Jun 25, 2021
1 parent
5a1af85
commit a6c5701
Showing
1 changed file
with
27 additions
and
19 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 |
---|---|---|
@@ -1,29 +1,37 @@ | ||
# A Svelte template on Gitpod | ||
|
||
# svelte app with Gitpod setup | ||
This is a [Svelte](https://svelte.dev) template configured for ephemeral development environments on [Gitpod](https://www.gitpod.io/). | ||
|
||
[![Gitpod ready-to-code](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/) | ||
## SvelteKit | ||
|
||
This is a project template for [Svelte](https://svelte.dev) apps. | ||
If you are looking for a SvelteKit example, please use https://github.com/gitpod-io/template-sveltekit. | ||
|
||
## SvelteKit | ||
## Next Steps | ||
|
||
Click the button below to start a new development environment: | ||
|
||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gitpod-io/template-sveltejs) | ||
|
||
If you are looking for a SvelteKit example, please use https://github.com/gitpod-io/sveltekit-example. | ||
## Get Started With Your Own Project | ||
|
||
## Special config for Gitpod to make rollup work | ||
### A new project | ||
|
||
Rollup needs to know how to reach the livereload endpoint. To configure that we need to do two things in our config: | ||
Click the above "Open in Gitpod" button to start a new workspace. Once you're ready to push your first code changes, Gitpod will guide you to fork this project so you own it. | ||
|
||
1) set an environment variable | ||
``` | ||
export CLIENT_URL="$(gp url 35729)/livereload.js?snipver=1&port=443" | ||
``` | ||
2) pass the env value to the livereload module in [`rollup.config.js:65`](https://github.com/gitpod-io/sveltejs-template/blob/587088aae9cb7331c27591b7f8cef9d58c037e46/rollup.config.js#L66-L69) | ||
```js | ||
!production && livereload({ | ||
watch: 'public', | ||
clientUrl: process.env.CLIENT_URL | ||
}), | ||
``` | ||
### An existing project | ||
|
||
This will set `CLIENT_URL` with the workspace url of `35729` (default port for livereload). | ||
To get started with Svelte on Gitpod, add a [`.gitpod.yml`](./.gitpod.yml) file which contains the configuration to improve the developer experience on Gitpod. To learn more, please see the [Getting Started](https://www.gitpod.io/docs/getting-started) documentation. | ||
|
||
In addition, please perform the following steps: | ||
1. Set an environment variable | ||
```bash | ||
export CLIENT_URL="$(gp url 35729)/livereload.js?snipver=1&port=443" | ||
``` | ||
1. Pass the env value to the livereload module in [`rollup.config.js:65`](https://github.com/gitpod-io/sveltejs-template/blob/587088aae9cb7331c27591b7f8cef9d58c037e46/rollup.config.js#L66-L69) | ||
```js | ||
!production && livereload({ | ||
watch: 'public', | ||
clientUrl: process.env.CLIENT_URL | ||
}), | ||
``` | ||
This will set `CLIENT_URL` with the workspace url of `35729` (default port for livereload). |