diff --git a/README.md b/README.md index ce91dcf5..bec20f44 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ export default () => ( #### Built-in CSS support +
+ Examples + - [Basic css](./examples/basic-css) +
+ We bundle [styled-jsx](https://github.com/zeit/styled-jsx) to provide support for isolated scoped CSS. The aim is to support "shadow CSS" resembling of Web Components, which unfortunately [do not support server-rendering and are JS-only](https://github.com/w3c/webcomponents/issues/71). ```jsx @@ -110,6 +115,11 @@ export default () => ( ### Populating `` +
+ Examples + - [Head elements](./examples/head-elements) +
+ We expose a built-in component for appending elements to the `` of the page. ```jsx @@ -162,6 +172,11 @@ For the initial page load, `getInitialProps` will execute on the server only. `g ### Routing +
+ Examples + - [Basic routing](./examples/using-routing) +
+ #### With `` Client-side transitions between routes can be enabled via a `` component. Consider these two pages: @@ -222,6 +237,11 @@ _Note: in order to programmatically change the route without triggering navigati ### Prefetching Pages +
+ Examples + - [Prefetching](./examples/with-prefetching) +
+ Next.js exposes a module that configures a `ServiceWorker` automatically to prefetch pages: `next/prefetch`. Since Next.js server-renders your pages, this allows all the future interaction paths of your app to be instant. Effectively Next.js gives you the great initial download performance of a _website_, with the ahead-of-time download capabilities of an _app_. [Read more](https://zeit.co/blog/next#anticipation-is-the-key-to-performance). @@ -271,6 +291,13 @@ export default ({ url }) => ( ### Custom server and routing +
+ Examples + - [Basic custom server](./examples/custom-server) + - [Express integration](./examples/custom-server-express) + - [Parameterized routing](./examples/parameterized-routing) +
+ Typically you start your next server with `next start`. It's possible, however, to start a server 100% programmatically in order to customize routes, use route patterns, etc This example makes `/a` resolve to `./pages/b`, and `/b` resolve to `./pages/a`: @@ -313,6 +340,11 @@ Supported options: ### Custom `` +
+ Examples + - [Styled components custom document](./examples/with-styled-components) +
+ Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include ``, ``, etc. But we still make it possible to override that: ```jsx @@ -371,6 +403,11 @@ export default class Error extends React.Component { ### Custom configuration +
+ Examples + - [Custom babel configuration](./examples/with-custom-babel-config) +
+ For custom advanced behavior of Next.js, you can create a `next.config.js` in the root of your project directory (next to `pages/` and `package.json`). Note: `next.config.js` is a regular Node.js module, not a JSON file. It gets used by the Next server and build phases, and not included in the browser build. @@ -543,7 +580,7 @@ It’s up to you. `getInitialProps` is an `async` function (or a regular functio
Can I use it with Redux? -Yes! Here's an [example](https://github.com/zeit/next.js/wiki/Redux-example) +Yes! Here's an [example](./examples/with-redux)
diff --git a/examples/with-jest/README.md b/examples/with-jest/README.md new file mode 100644 index 00000000..62e1e9c2 --- /dev/null +++ b/examples/with-jest/README.md @@ -0,0 +1,35 @@ +# Example app with jest tests + +## How to use + +Download the example: + +```bash +curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-jest +cd with-jest +``` + +or clone the repo: + +```bash +git clone https://github.com/zeit/next.js.git --depth=1 +cd next.js/examples/with-jest +``` + +Install the dependencies: + +```bash +npm install +``` + +Run the tests: + +```bash +npm test +``` + +## The idea behind the example + +This example features: + +* An app with jest tests