0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-22 03:47:27 +01:00
svelte/site
Alexis Ménard ebbdb4277c
Tutorial : a better explanation of component events (#4639)
* feat(tutorial): better explanation of component events

Co-Authored-By: Antony Jones <ant@enzy.org>
2021-02-04 10:10:34 +00:00
..
content Tutorial : a better explanation of component events (#4639) 2021-02-04 10:10:34 +00:00
migrations use cookies instead of JWT 2019-08-17 11:32:35 -04:00
scripts Handle new format for "who is using svelte" (#5918) 2021-01-22 12:28:01 -08:00
src Change color on 404 page (#5932) 2021-01-31 07:01:01 +08:00
static site a11y: add missing h1s (#5715) 2020-12-24 17:54:03 -05:00
test/utils Site: use pure javascript slugification library 2019-04-28 09:54:38 -04:00
.dockerignore site: use gcloud CLI to build Docker image 2019-04-22 01:59:48 -04:00
.env.example chore: update database ENV keys 2019-09-30 21:00:24 -07:00
.eslintrc.js lint during CI 2019-10-11 18:49:11 -04:00
.gcloudignore site: use gcloud CLI to build Docker image 2019-04-22 01:59:48 -04:00
.travis.yml Bring svelte.technology source into main repo 2018-12-22 16:09:27 -05:00
appveyor.yml site: remove cypress leftovers and upgrade dependencies (#5824) 2020-12-29 06:02:49 -08:00
config.js Site: use pure javascript slugification library 2019-04-28 09:54:38 -04:00
Dockerfile site: add warning to Dockerfile about .dockerignore 2020-01-22 20:26:43 -05:00
Makefile site: standardize building command (#5380) 2020-09-10 19:55:41 -04:00
package-lock.json site: bump dependencies to fix building in production mode (#5846) 2021-01-01 19:15:48 -05:00
package.json site: remove cypress leftovers and upgrade dependencies (#5824) 2020-12-29 06:02:49 -08:00
README.md site: standardize building command (#5380) 2020-09-10 19:55:41 -04:00
rollup.config.js site: remove cypress leftovers and upgrade dependencies (#5824) 2020-12-29 06:02:49 -08:00

Running locally

Set up the site sub-project:

git clone https://github.com/sveltejs/svelte.git
cd site
npm ci
npm run update
npm run dev

and navigate to localhost:3000.

Running using the local copy of Svelte

By default, the REPL will fetch the most recent version of Svelte from https://unpkg.com/svelte. When running the site locally, you can also use your local copy of Svelte.

To produce the proper browser-compatible UMD build of the compiler, you will need to run npm run build (or npm run dev) in the root of this repository with the PUBLISH environment variable set to any non-empty string:

git clone https://github.com/sveltejs/svelte.git
cd svelte
npm ci
PUBLISH=1 npm run build
cd site
npm ci
npm run update
npm run dev

Then visit the REPL at localhost:3000/repl?version=local. Please note that the local REPL only works with npm run dev and not when building the site for production usage.

REPL GitHub integration

In order for the REPL's GitHub integration to work properly when running locally, you will need to:

  • create a GitHub OAuth app:
    • set Authorization callback URL to http://localhost:3000/auth/callback;
    • set Application name as you like, and Homepage URL as http://localhost:3000/;
    • create the app and take note of Client ID and Client Secret
  • in this repo, create site/.env containing:
    GITHUB_CLIENT_ID=[your app's Client ID]
    GITHUB_CLIENT_SECRET=[your app's Client Secret]
    BASEURL=http://localhost:3000
    

Building the site

To build the website, run npm run build. The output can be found in __sapper__/build.

Testing

Tests can be run using npm run test.

Linking @sveltejs/site-kit and @sveltejs/site-repl

This site depends on @sveltejs/site-kit, a collection of styles, components and icons used in common by *.svelte.dev websites, and @sveltejs/site-repl.

In order to work on features that depend on those packages, you need to link their repositories:

  • cd <somewhere>
  • git clone https://github.com/sveltejs/site-kit
  • git clone https://github.com/sveltejs/svelte-repl
  • cd <somewhere>/site-kit
  • npm link
  • cd <somewhere>/svelte-repl
  • npm link
  • cd <svelte-repo>/site
  • npm link @sveltejs/site-kit
  • npm link @sveltejs/svelte-repl

Translating the API docs

Anchors are automatically generated using headings in the documentation and by default (for the english language) they are latinised to make sure the URL is always conforming to RFC3986.

If we need to translate the API documentation to a language using unicode chars, we can setup this app to export the correct anchors by setting up SLUG_PRESERVE_UNICODE to true in config.js.