Skip to content

Commit

Permalink
Merge branch 'canary' into fix/api-not-ending
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Jan 10, 2020
2 parents fe758cb + dd020fb commit 58a05e0
Show file tree
Hide file tree
Showing 113 changed files with 707 additions and 749 deletions.
2 changes: 1 addition & 1 deletion docs/basic-features/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Data is always up-to-date but it comes at the cost of a slightly higher [Time to
// Next.js will execute `getInitialProps`
// It will wait for the result of `getInitialProps`
// When the results comes back Next.js will render the page.
// Next.js wil do this for every request that comes in.
// Next.js will do this for every request that comes in.
import fetch from 'isomorphic-unfetch'

function HomePage({ stars }) {
Expand Down
2 changes: 1 addition & 1 deletion docs/basic-features/static-file-serving.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export default MyImage

> Don't name the `public` directory anything else. The name can't be changed and is the only directory that **Next.js** uses to serve static assets.
> If you ever add a static asset that conflicts with the name of a `page`, the public file will be ignored in favor of the `page`.
> If you ever add a static asset that conflicts with the name of a page in the `pages` directory, the public file will be ignored in favor of the file in `pages`.
4 changes: 2 additions & 2 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ You can link your project in [GitHub](https://zeit.co/new), [GitLab](https://zei

You can install the command line tool using npm:

```
```bash
npm install -g now
```

You can deploy your application by running the following command in the root of the project directory:

```
```bash
now
```

Expand Down
22 changes: 22 additions & 0 deletions errors/css-global.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Global CSS Must Be in Your Custom \<App\>

#### Why This Error Occurred

An attempt to import Global CSS from a file other than [`pages/_app.js`](https://nextjs.org/docs/advanced-features/custom-app) was made.

Global CSS cannot be used in files other than your [Custom `<App>`](https://nextjs.org/docs/advanced-features/custom-app) due to its side-effects and ordering problems.

#### Possible Ways to Fix It

Relocate all Global CSS imports to your [`pages/_app.js` file](https://nextjs.org/docs/advanced-features/custom-app).

#### Example

```jsx
// pages/_app.js
import '../styles.css'

export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
```
27 changes: 27 additions & 0 deletions errors/css-npm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# CSS Imported by a Dependency

#### Why This Error Occurred

One of your dependencies (`node_modules`) imports a CSS file.

This normally happens when a package's source files are accidentally consumed,
instead of the built package.

#### Possible Ways to Fix It

Reach out to the maintainer and ask for them to publish a compiled version of
their dependency.

Compiled dependencies do not have references to CSS files, or any other files
that require bundler-specific integrations.

The dependency should also provide instructions about what CSS needs to be
imported by you, in your application.

Importing CSS files within `node_modules` cannot be supported because we cannot
know the correct behavior:

- Should the file be consumed as Global CSS or CSS Modules?
- If Global, in what order does the file need to be injected?
- If Modules, what are the emitted class names? As-is, camel-case, snake case?
- Etc...
11 changes: 0 additions & 11 deletions errors/global-css.md

This file was deleted.

152 changes: 0 additions & 152 deletions examples/blog-starter/components/syntax-highlight.css

This file was deleted.

30 changes: 8 additions & 22 deletions examples/blog-starter/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,14 @@ module.exports = withMDX({
module: 'empty',
}

config.module.rules.push(
{
test: /\.css$/,
use: [
defaultLoaders.babel,
{
loader: require('styled-jsx/webpack').loader,
options: {
type: 'global',
},
},
],
},
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
},
],
}
)
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
},
],
})

if (isServer && !dev) {
const originalEntry = config.entry
Expand Down
1 change: 0 additions & 1 deletion examples/blog-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"now-build": "next build && yarn build:rss"
},
"dependencies": {
"@zeit/next-css": "^1.0.1",
"@zeit/next-mdx": "^1.2.0",
"babel-plugin-macros": "^2.5.0",
"babel-plugin-preval": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/with-cookie-auth/components/header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from 'next/link'
import { logout } from '../utils/auth'

const Header = props => (
const Header = () => (
<header>
<nav>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions examples/with-cookie-auth/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Head from 'next/head'
import Header from './header'

const Layout = props => (
<React.Fragment>
<>
<Head>
<title>With Cookies</title>
</Head>
Expand Down Expand Up @@ -34,7 +34,7 @@ const Layout = props => (
<main>
<div className="container">{props.children}</div>
</main>
</React.Fragment>
</>
)

export default Layout
3 changes: 0 additions & 3 deletions examples/with-cookie-auth/next.config.js

This file was deleted.

12 changes: 6 additions & 6 deletions examples/with-cookie-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"start": "next start"
},
"dependencies": {
"isomorphic-unfetch": "^3.0.0",
"js-cookie": "^2.2.0",
"next": "^9.0.1",
"next-cookies": "^1.0.4",
"react": "^16.8.6",
"react-dom": "^16.8.6"
"isomorphic-unfetch": "latest",
"js-cookie": "latest",
"next": "latest",
"next-cookies": "latest",
"react": "latest",
"react-dom": "latest"
}
}
4 changes: 2 additions & 2 deletions examples/with-cookie-auth/pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import fetch from 'isomorphic-unfetch'
import Layout from '../components/layout'
import { login } from '../utils/auth'

function Login() {
const Login = () => {
const [userData, setUserData] = useState({ username: '', error: '' })

async function handleSubmit(event) {
const handleSubmit = async event => {
event.preventDefault()
setUserData(Object.assign({}, userData, { error: '' }))

Expand Down
3 changes: 0 additions & 3 deletions examples/with-external-scoped-css/README.md

This file was deleted.

7 changes: 2 additions & 5 deletions examples/with-higher-order-component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@ Install it and run:
```bash
npm install
npm run dev
# or
yarn
yarn dev
```

**yarn**

```bash
npm install
npm run dev
yarn
yarn dev
```

Deploy it to the cloud with [now](https://zeit.co/now)
Expand Down
2 changes: 1 addition & 1 deletion examples/with-next-css/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ now

## The idea behind the example

This example demonstrates how to use the [next-css plugin](https://github.com/zeit/next-plugins/tree/master/packages/next-css) It includes patterns for with and without CSS Modules, with PostCSS and with additional webpack configurations on top of the next-css plugin.
This example demonstrates how to use Next.js' built-in CSS imports and CSS modules support.
7 changes: 7 additions & 0 deletions examples/with-next-css/component/hello-world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import css from './hello-world.module.css'

export default () => (
<div className={css.hello}>
Hello World, I am being styled using CSS Modules!
</div>
)
3 changes: 3 additions & 0 deletions examples/with-next-css/component/hello-world.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.hello {
font-size: 25px;
}

0 comments on commit 58a05e0

Please sign in to comment.