Commit 0d6ceec8 authored by Giuseppe's avatar Giuseppe Committed by Guillermo Rauch

Add styled-jsx-postcss example (#781)

* Add styled-jsx-postcss example

* Remove commented code
parent 782807bb
{
"presets": [
"next/babel"
],
"plugins": [
"styled-jsx-postcss/babel"
]
}
# Example app with styled-jsx-postcss
This example features how you use PostCSS with styled-jsx via [styled-jsx-postcss](https://github.com/giuseppeg/styled-jsx-postcss)
## How to use
Download the example (or clone the repo)[https://github.com/zeit/next.js.git]:
```bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-styled-jsx-postcss
cd with-styled-jsx-postcss
```
Install it and run:
```bash
npm install
npm run dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
{
"name": "with-styled-jsx-postcss",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^2.0.0-beta",
"postcss-cssnext": "^2.9.0",
"styled-jsx-postcss": "^0.1.5"
},
"author": "Giuseppe Gurgone",
"license": "MIT"
}
export default () => (
<div className='hello'>
<p>Hello World</p>
<style jsx>{`
:global(:root) {
--bgColor: green;
--color: white;
}
.hello {
font: 15px Helvetica, Arial, sans-serif;
background: var(--bgColor);
color: var(--color);
padding: 100px;
text-align: center;
transition: 100ms ease-in background;
}
.hello:hover {
color: color(var(--color) blackness(+80%));
}
`}</style>
</div>
)
module.exports = () => ({
plugins: {
'postcss-cssnext': {}
}
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment