README.md 1.8 KB
Newer Older
1 2 3 4
# Stenciljs example

## Deploy your own

T
Tim Neutkens 已提交
5
Deploy the example using [Vercel](https://vercel.com):
6

7
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-stencil)
8 9 10 11 12

## How to use

### Using `create-next-app`

13
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example:
14 15 16 17 18 19 20 21 22 23 24 25

```bash
npx create-next-app --example with-stencil with-stencil-app
# or
yarn create next-app --example with-stencil with-stencil-app
```

### Download manually

Download the example:

```bash
26
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-stencil
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
cd with-stencil
```

Build stencil component:

```bash
cd packages/test-component
yarn build
```

Install it and run:

```bash
yarn
yarn dev
```

T
Tim Neutkens 已提交
44
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
45

A
Andy 已提交
46 47
> Choose `packages/web-app` as root directory when deploying.

48 49 50 51 52 53 54 55 56 57 58 59 60 61
## The idea behind the example

Stencil is a compiler that generates Web Components (more specifically, Custom Elements). Stencil combines the best concepts of the most popular frameworks into a simple build-time tool.

In this example we have two workspaces:

- **web-app**: A Next.js app
- **test-component**: A stencil components

## Useful Links

- [Documentation](https://stenciljs.com/docs/introduction)
- [yarn workspaces](https://yarnpkg.com/lang/en/docs/cli/workspace)
- [yarn workspace](https://yarnpkg.com/lang/en/docs/cli/workspaces)