Skip to content

Commit 9701887

Browse files
akoushkelalli-flores
authored andcommitted
fix(style): bundle momentum-ui styling modules
1 parent 4e3e8e0 commit 9701887

File tree

5 files changed

+64
-55
lines changed

5 files changed

+64
-55
lines changed

.storybook/webpack.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ module.exports = async ({config, mode}) => {
1313
{
1414
loader: 'sass-resources-loader',
1515
options: {
16-
resources: [
17-
path.resolve(__dirname, '../src/styles/index.scss'),
18-
path.resolve(__dirname, '../momentum-ui.scss'),
19-
],
16+
resources: [path.resolve(__dirname, '../src/styles/index.scss')],
2017
},
2118
},
2219
],

README.md

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
**Webex Components** is a set of [React](https://reactjs.org) components following Webex standard styling, aimed at react developers that want to embed the components into their applications.
1919

20-
2120
## Table of Contents
21+
2222
- [Install](#install)
2323
- [Usage](#usage)
2424
- [Contributing](#contributing)
@@ -29,84 +29,78 @@
2929
## Install
3030

3131
```bash
32-
npm install --save @webex/components @momentum-ui/react
32+
npm install --save @webex/components
3333
```
3434

3535
## Usage
36-
**Webex Components** are built with [Momentum UI](https://github.com/momentum-design/momentum-ui) React components. We need to externally import all the fonts, icons, images and core *CSS* manually. There are two ways to do this:
37-
38-
### 1. CSS
39-
1. Copy the `@momentum-ui/core/fonts` directory to the 'fonts' directory for your site.
40-
2. Copy the `@momentum-ui/core/images` directory to the 'images' directory for your site.
41-
3. Copy the `@momentum-ui/core/css/momentum-ui.min.css` to your styles/css directory.
42-
4. In the `<head>`, of your HTML reference the location of your momentum-ui.min.css:
43-
44-
`<link rel='stylesheet' href='path/to/momentum-ui/css/momentum-ui.min.css'>`
45-
46-
***
47-
### 2. SCSS
48-
1. Add `$brand-font-folder` and `$icon-font-path` variables to the top of your app's Sass file.
4936

37+
We need to externally import all the fonts, icons, images and core _CSS_ manually. Import `@webex/components/dist/webexComponents.css` into your main entry file. There are two ways to do this:
5038

51-
```scss
52-
$brand-font-folder: "~@momentum-ui/core/fonts";
53-
$icon-font-path: "~@momentum-ui/icons/fonts";
54-
```
39+
### 1. JavaScript
5540

56-
2. Import `@momentum-ui/core/scss/momentum-ui-components` into your main entry Sass file AFTER the variables.
41+
```js
42+
import '@webex/components/dist/webexComponents.css';
43+
```
5744

58-
```scss
59-
@import "~@momentum-ui/core/scss/momentum-ui-components";
60-
```
45+
### 2. Html
6146

62-
3. Compile Sass files using your static compiler or bundler (Webpack, Grunt, Gulp, etc.)
63-
***
47+
```html
48+
<head>
49+
<link rel="stylesheet" type="text/css" href="node_modules/@webex/components/dist/webexComponents.css" />
50+
</head>
51+
```
6452

65-
Once Momentum styles have been imported into your project, you can start using the components. For example:
53+
Once Webex styles have been imported into your project, you can start using the components. For example:
6654

67-
```js
68-
import {WebexAvatar} from '@webex/components';
55+
```js
56+
import {WebexAvatar} from '@webex/components';
6957

70-
function App() {
71-
return (
72-
<div className='App'>
73-
<WebexAvatar title='Webex Avatar' />
74-
</div>
75-
);
76-
}
58+
function App() {
59+
return (
60+
<div className="App">
61+
<WebexAvatar title="Webex Avatar" />
62+
</div>
63+
);
64+
}
7765

78-
export default App;
79-
```
66+
export default App;
67+
```
8068

81-
*Happy Coding!*
69+
_Happy Coding!_
8270

8371
## Contributing
72+
8473
We'd love for you to contribute to our source code and to make **Webex Components** even better than it is today! Here are some [guidelines](https://github.com/webex/components/blob/master/CONTRIBUTING.md) that we'd like you to follow.
8574

8675
### Issues
76+
8777
Please open an [issue](https://github.com/webex/components/issues) and we will get to it in an orderly manner.
8878
Please leave as much as information as possible for a better understanding.
79+
8980
### Contributing Code
81+
9082
We are using [Webex Style Guide eslint rule](https://github.com/webex/web-styleguide/tree/master/packages/node_modules/%40webex/eslint-config-react) and [prettier](https://github.com/prettier/prettier) to lint the code style.
9183
You can "prettify" your code before committing via:
9284

93-
```bash
94-
npm run prettier:write
95-
```
85+
```bash
86+
npm run prettier:write
87+
```
9688

9789
### Release Process
90+
9891
There is a list of commit types provided [here](https://github.com/webex/components/blob/master/CONTRIBUTING.md#type). However, not all commits trigger our release process.
9992
We are using [semantic-release](https://github.com/semantic-release/semantic-release) to fully automate the version management and package publishing.
10093
By default `semantic-release` uses the [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) and triggers release and publishing based on the following rules:
10194

102-
|Commit|Release type|
103-
|------|------------|
104-
|Commit with type `BREAKING CHANGE` | Major release|
105-
|Commit with type `feat`| Minor release|
106-
|Commit with type `fix` | Patch release|
107-
|Commit with type `perf`| Patch release|
95+
| Commit | Release type |
96+
| ---------------------------------- | ------------- |
97+
| Commit with type `BREAKING CHANGE` | Major release |
98+
| Commit with type `feat` | Minor release |
99+
| Commit with type `fix` | Patch release |
100+
| Commit with type `perf` | Patch release |
108101

109102
#### Commit linter
103+
110104
We are using [commitlint](https://github.com/conventional-changelog/commitlint) to lintify the commit messages.
111105
Please make sure to choose the appropriate commit [type](https://github.com/webex/components/blob/master/CONTRIBUTING.md#type), [scope](https://github.com/webex/components/blob/master/CONTRIBUTING.md#scope) and [subject](https://github.com/webex/components/blob/master/CONTRIBUTING.md#scope).
112106

@@ -115,9 +109,11 @@ Please make sure to choose the appropriate commit [type](https://github.com/webe
115109
[MIT License](https://opensource.org/licenses/MIT)
116110

117111
## Support
112+
118113
For more developer resources, tutorials and support, visit the Webex developer portal, https://developer.webex.com.
119114

120115
## Team
121-
| [![Adam Weeks](https://github.com/adamweeks.png?size=100)](https://github.com/adamweeks)| [![Arash Koushkebaghi](https://github.com/akoushke.png?size=100)](https://github.com/akoushke)| [![Lalli Flores](https://github.com/lalli-flores.png?size=100)](https://github.com/lalli-flores)| [![Timothy Scheuering](https://github.com/InteractiveTimmy.png?size=100)](https://github.com/InteractiveTimmy)|[![David Hoff](https://github.com/harborhoffer.png?size=100)](https://github.com/harborhoffer)
122-
|-----|-----|-----|-----|----|
123-
|[Adam Weeks](https://github.com/adamweeks)|[Arash Koushkebaghi](https://github.com/akoushke)|[Lalli Flores](https://github.com/lalli-flores) | [Timothy Scheuering](https://github.com/InteractiveTimmy) | [David Hoff](https://github.com/harborhoffer)
116+
117+
| [![Adam Weeks](https://github.com/adamweeks.png?size=100)](https://github.com/adamweeks) | [![Arash Koushkebaghi](https://github.com/akoushke.png?size=100)](https://github.com/akoushke) | [![Lalli Flores](https://github.com/lalli-flores.png?size=100)](https://github.com/lalli-flores) | [![Timothy Scheuering](https://github.com/InteractiveTimmy.png?size=100)](https://github.com/InteractiveTimmy) | [![David Hoff](https://github.com/harborhoffer.png?size=100)](https://github.com/harborhoffer) |
118+
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
119+
| [Adam Weeks](https://github.com/adamweeks) | [Arash Koushkebaghi](https://github.com/akoushke) | [Lalli Flores](https://github.com/lalli-flores) | [Timothy Scheuering](https://github.com/InteractiveTimmy) | [David Hoff](https://github.com/harborhoffer) |

rollup.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,22 @@ export default [
2424
output('UMDWebexComponents', 'umd'),
2525
output('ESMWebexComponents', 'esm'),
2626
],
27-
plugins: [resolve(), babel(), commonJS(), json(), scss()],
27+
plugins: [
28+
resolve(),
29+
babel(),
30+
commonJS(),
31+
json(),
32+
scss({
33+
includePaths: ['node_modules'],
34+
output: 'dist/webexComponents.css',
35+
failOnError: true,
36+
// remove `~` from node_modules import declarations.
37+
// more info: https://github.com/facebook/create-react-app/issues/2859#issuecomment-318059618
38+
importer(path) {
39+
return {file: path[0] === '~' ? path.slice(1) : path};
40+
},
41+
}),
42+
],
2843
onwarn(warning, warn) {
2944
// skip circular dependency warnings from @momentum-ui/react library
3045
if (warning.code === 'CIRCULAR_DEPENDENCY') return;

src/styles/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
@import 'momentum-ui.scss';
12
@import 'mixins';
File renamed without changes.

0 commit comments

Comments
 (0)