You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each component that you work on will need to be built for you to see the changes. Every component has a gulpfile and an npm script, `npm run dev`, that you can run on each component that you're working on. The `npm run dev` command will watch the files in the component's directory and will run the build command when you make changes to the component.
37
+
Because this is a monorepo, each component will need to be independently built in order to actively work on and preview the changes. Every component has its own Gulp file and NPM script.
25
38
26
-
### Example Development on a component
39
+
While still running `npm start` in one terminal window (which runs the local server), you will need to open another terminal window, drill into the directory of the component you'd like to work on, and execute the `npm run dev` command. This command will use gulp tasks to watch the files within that component directory and will automatically re-run the build command and refresh the browser when you make changes to the component.
40
+
41
+
### Example development on a component
27
42
28
43
```
29
-
cd elements/rh-card
30
-
npm run dev
44
+
$ cd /Sites/rhelement
45
+
$ npm start
46
+
47
+
# SHIFT + CTRL + T to open a new tab in Terminal
48
+
49
+
$ cd elements/rh-card # or any other component
50
+
$ npm run dev
31
51
```
32
52
33
-
Make any changes you need and the gulpfile will handle transpiling the element down to ES5 and will bring in the HTML template and Sass file into the template in the component.
53
+
Make a change to the component and save. The gulpfile will handle transpiling the element down to ES5 and will bring in the HTML and Sass into the template in the component.
34
54
35
-
If you started the dev server at the root of RHElements, then you should be able to navigate to the demo page for the component, refresh the page, and see your changes.
55
+
## Test
36
56
37
57
To test all RHElements, run `npm test` from the root of the repo. If you only want to test the component you're working on:
38
58
39
-
cd elements/rh-card
40
-
npm test
59
+
```
60
+
$ cd elements/rh-card
61
+
$ npm test # DOESN'T WORK
62
+
```
41
63
42
64
Also, if your tests are failing and you want access to a live browser to investigate why, the following flag will keep the browser open.
43
65
44
-
npm test -- -p
66
+
```
67
+
$ npm test -- -p
68
+
```
45
69
46
70
Then open the URL that will be printed in the terminal. It looks something like this: `http://localhost:8081/components/@rhelements/rhelements/generated-index.html?cli_browser_id=0`.
47
71
@@ -52,15 +76,15 @@ We've added [Storybook](https://storybook.js.org/) to RHElements as a way to pre
52
76
To run storybook
53
77
54
78
```
55
-
npm run storybook
79
+
$ npm run storybook
56
80
```
57
81
58
82
This will start a web server on port 9001. Navigate in your browser to `http://localhost:9001` to see Storybook in action. Storybook will watch for file changes and reload the browser automatically for you. This is a little slow at the moment, but we'll look into speeding this up.
59
83
60
84
To export the storybook static site
61
85
62
86
```
63
-
npm run build-storybook
87
+
$ npm run build-storybook
64
88
```
65
89
66
90
This places a build of the storybook site in the .storybook_out directory.
0 commit comments