Skip to content

Commit

Permalink
add css-custom-config example
Browse files Browse the repository at this point in the history
  • Loading branch information
lucleray committed Nov 5, 2018
1 parent 419f2a9 commit 8307f0f
Show file tree
Hide file tree
Showing 7 changed files with 4,583 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/css-custom-config/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const withCss = require('@zeit/next-css')
const withPurgeCss = require('../../index')

module.exports = withCss(
withPurgeCss({
purgeCssPaths: ['pages/**/*', 'components/**/*', 'other-components/**/*'],
purgeCss: {
whitelist: () => ['unused-but-whitelisted-class']
}
})
)
1 change: 1 addition & 0 deletions examples/css-custom-config/other-components/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => <div className="button-blue">Blue button</div>
16 changes: 16 additions & 0 deletions examples/css-custom-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^7.0.2",
"react": "^16.6.0",
"react-dom": "^16.6.0"
},
"devDependencies": {
"@zeit/next-css": "^1.0.1",
"next-purgecss": "^2.0.0-beta.1"
}
}
3 changes: 3 additions & 0 deletions examples/css-custom-config/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import '../style.css'

export default () => <div className="example">Hello World!</div>
6 changes: 6 additions & 0 deletions examples/css-custom-config/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Example with a custom config (check out [next.config.js](next.config.js)).

To start :

- `yarn install`
- `yarn dev`
15 changes: 15 additions & 0 deletions examples/css-custom-config/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.example {
font-size: 50px;
}

.button-blue {
color: blue;
}

.unused-but-whitelisted-class {
color: green;
}

.unused-css-class {
color: red;
}
Loading

0 comments on commit 8307f0f

Please sign in to comment.