Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add global stylesheet example #1016

Merged
merged 4 commits into from
Feb 11, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update readme
  • Loading branch information
davibe committed Feb 11, 2017
commit d3a638197c1c03f53702d07c3832e14f27a25646
23 changes: 18 additions & 5 deletions examples/with-global-stylesheet/README.md
Original file line number Diff line number Diff line change
@@ -1,9 1,16 @@
README
------
# Global Stylesheet example

This is an example of how you can include a global stylesheet in a next.js webapp.

### Running

## How to use

Download the example [or clone the repo](https://github.com/zeit/next.js):

```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-global-stylesheet
cd with-global-stylesheet
```

To get this example running you just need to

Expand All @@ -15,7 22,14 @@ Visit [http://localhost:300](http://localhost:300) and try to modify `pages/styl
Also see it working with plain css here
![example](example.gif)

### Explanation
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))

```bash
now
```


## The idea behind the example

The strategy here is to transpile the stylesheet file to a css-in-js file so that it can be loaded and hot reloaded both on the server and the client. For this purpose i created a babel loader plugin called [babel-loader-wrap-in-js](https://github.com/davibe/babel-plugin-wrap-in-js)

Expand All @@ -26,6 40,5 @@ This project shows how you can set it up. Have a look at
- pages/index.js



Please, report any issue on enhancement related to this example to its original
github repository https://github.com/davibe/next.js-css-global-style-test