Skip to content

Commit bacb42e

Browse files
impronunciablerauchg
authored andcommitted
Updated README with new features and code fixes (#444)
* Updated README with new features and code fixes * Removed staticMarkup option from docs. * Fixed quiet parameter info.
1 parent b337433 commit bacb42e

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

README.md

+20-24
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ It's possible to use any existing CSS-in-JS solution. The simplest one is inline
9292

9393
```jsx
9494
export default () => (
95-
<p style={{ color: red }}>hi there</p>
95+
<p style={{ color: 'red' }}>hi there</p>
9696
)
9797
```
9898

@@ -264,13 +264,15 @@ Most needs are addressed by `<Link />`, but we also expose an imperative API for
264264
```jsx
265265
import { prefetch } from 'next/prefetch'
266266
export default ({ url }) => (
267-
<a onClick={ () => setTimeout(() => url.pushTo('/dynamic'), 100) }>
268-
A route transition will happen after 100ms
269-
</a>
270-
{
271-
// but we can prefetch it!
272-
prefetch('/dynamic')
273-
}
267+
<div>
268+
<a onClick={ () => setTimeout(() => url.pushTo('/dynamic'), 100) }>
269+
A route transition will happen after 100ms
270+
</a>
271+
{
272+
// but we can prefetch it!
273+
prefetch('/dynamic')
274+
}
275+
</div>
274276
)
275277
```
276278

@@ -308,11 +310,13 @@ app.prepare().then(() => {
308310
```
309311

310312
The `next` API is as follows:
311-
- `next(path: string, opts: objecvt)` - `path` is where the Next project is located
313+
- `next(path: string, opts: objecvt)` - `path` is
312314
- `next(opts: object)`
313315

314316
Supported options:
315-
- `dev` (`bool`) whether to launch Next.js in dev mode
317+
- `dev` (`bool`) whether to launch Next.js in dev mode - default `false`
318+
- `dir` (`string`) where the Next project is located - default `'.'`
319+
- `quiet` (`bool`) Display error messages with server information - default `false`
316320

317321
### Custom `<Document>`
318322

@@ -441,11 +445,8 @@ Note: we recommend putting `.next` in `.npmignore` or `.gitignore`. Otherwise, u
441445
<details>
442446
<summary>How big is it?</summary>
443447

444-
The client side next bundle, which includes React and Glamor is **73kb** gzipped.
445-
446-
The Next runtime (lazy loading, routing, `<Head>`) contributes around **15%** to the size of that bundle.
447-
448-
The codebase is ~1500LOC (excluding CLI programs).
448+
The client side bundle size should be measured in a per-app basis.
449+
A small Next main bundle is around 65kb gzipped.
449450

450451
</details>
451452

@@ -470,15 +471,10 @@ If you want to create re-usable React components that you can embed in your Next
470471
</details>
471472

472473
<details>
473-
<summary>Why CSS-in-JS?</summary>
474-
475-
`next/css` is powered by [Glamor](https://github.com/threepointone/glamor). While it exposes a JavaScript API, it produces regular CSS and therefore important features like `:hover`, animations, media queries all work.
476-
477-
There’s *no tradeoff* in power. Instead, we gain the power of simpler composition and usage of JavaScript expressions.
474+
<summary>How do I use CSS-in-JS solutions</summary>
478475

479-
*Compiling* regular CSS files would be counter-productive to some of our goals. Some of these are listed below.
476+
Next.js bundles [styled-jsx](https://github.com/zeit/styled-jsx) supporting scoped css. However you can use a CSS-in-JS solution in your Next app by just including your favorite library [as mentioned before](#css-in-js) in the document.
480477

481-
**Please note**: we are very interested in supporting regular CSS, since it's so much easier to write and already familiar. To that end, we're currently exploring the possibility of leveraging Shadow DOM to avoid the entire CSS parsing and mangling step [[#22](https://github.com/zeit/next.js/issues/22)]
482478

483479
### Compilation performance
484480

@@ -538,9 +534,9 @@ We tested the flexibility of the routing with some interesting scenarios. For an
538534
<details>
539535
<summary>How do I define a custom fancy route?</summary>
540536

541-
We’re adding the ability to map between an arbitrary URL and any component by supplying a request handler: [#25](https://github.com/zeit/next.js/issues/25)
537+
We [added](#custom-server-and-routing) the ability to map between an arbitrary URL and any component by supplying a request handler.
542538

543-
On the client side, we'll add a parameter to `<Link>` so that it _decorates_ the URL differently from the URL it _fetches_.
539+
On the client side, we have a parameter call `as` on `<Link>` that _decorates_ the URL differently from the URL it _fetches_.
544540
</details>
545541

546542
<details>

examples/with-prefetching/components/Header.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default () => (
1414

1515
{ /* we imperatively prefetch on hover */ }
1616
<RegularLink href='/about'>
17-
<a onMouseEnter={ () => prefetch('/about') && console.log('prefetching /about!') }>About</a>
17+
<a onMouseEnter={() => prefetch('/about') && console.log('prefetching /about!')}>About</a>
1818
</RegularLink>
1919

2020
<Link href='/contact' prefetch={false}>

0 commit comments

Comments
 (0)