Skip to content

Commit

Permalink
Update examples/with-carbon-components (#15190)
Browse files Browse the repository at this point in the history
The example used an outdated version of carbon components v9.

The latest got a huge facelift, new components and a lot of optimizations.
I updated the example with carbon-components v10.
  • Loading branch information
bogy0 authored Jul 17, 2020
1 parent 14eb907 commit f3f4ca3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 57 deletions.
8 changes: 8 additions & 0 deletions examples/with-carbon-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ yarn dev
```

Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

## Optimizations

In this example we import carbon components in the `styles/custom-theme.scss` file like this:
@import '~carbon-components/scss/globals/scss/styles.scss';

When we start to consider the performance of this approach, however, it becomes clear that this will include every single bit of CSS that Carbon outputs. Sometimes, you totally need everything that the project provides, but for a good number of teams you may find yourself using only a subset of our components. Here is a great article about how you can optimize your application using carbon components:
https://medium.com/carbondesign/minimal-css-with-carbon-b0c089ccfa71
6 changes: 4 additions & 2 deletions examples/with-carbon-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
},
"license": "ISC",
"dependencies": {
"carbon-components": "^9.6.4",
"carbon-components-react": "^6.19.1",
"@carbon/icons-react": "^10.3.0",
"carbon-components": "^10.3.0",
"carbon-components-react": "^7.3.0",
"carbon-icons": "^7.0.7",
"next": "latest",
"node-sass": "^4.12.0",
"react": "^16.7.0",
"react-dom": "^16.7.0"
}
Expand Down
1 change: 0 additions & 1 deletion examples/with-carbon-components/styles/custom-theme.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import './export.scss';
@import '~carbon-components/scss/globals/scss/styles.scss';
54 changes: 0 additions & 54 deletions examples/with-carbon-components/styles/export.scss

This file was deleted.

0 comments on commit f3f4ca3

Please sign in to comment.