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
Copy file name to clipboardExpand all lines: DEVELOP.md
+26-21Lines changed: 26 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,29 +3,32 @@
3
3
If you've made it this far, **thank you**! We appreciate your contribution, and hope that this document helps you along the way. If you have any questions or problems, don't hesitate to [file an issue](https://github.com/primer/css/issues/new).
4
4
5
5
## Structure
6
+
6
7
Primer CSS is published to [npm] as [@primer/css]. Each of Primer CSS's "modules" lives in a subfolder under `src/` with an `index.scss` in it. Generally speaking, the styles are divided into three primary themes:
7
8
8
-
***Core** styles (in `core/`) are common dependencies, which include support variables, native element and typography styles, buttons, navigation, tooltips, etc.
9
-
***Product** styles (in `product/`) are specific to github.com, and include components such as avatars, labels, markdown styles, popovers, and progress indicators.
10
-
***Marketing** styles (in `marketing/`) are specific to GitHub marketing efforts, including international and event-focused sites as well as the more design-heavy feature pages on github.com. Marketing styles include new colors and button styles, and extend the core typography and whitespace scales.
9
+
-**Core** styles (in `core/`) are common dependencies, which include support variables, native element and typography styles, buttons, navigation, tooltips, etc.
10
+
-**Product** styles (in `product/`) are specific to github.com, and include components such as avatars, labels, markdown styles, popovers, and progress indicators.
11
+
-**Marketing** styles (in `marketing/`) are specific to GitHub marketing efforts, including international and event-focused sites as well as the more design-heavy feature pages on github.com. Marketing styles include new colors and button styles, and extend the core typography and whitespace scales.
11
12
12
13
### Paths
13
-
Here's what you need to know about how the files are structured in both git and in the published npm module:
14
14
15
-
* In git, all of the SCSS source files live in the `src/` directory.
16
-
* When published, all of the files in `src/` are "hoisted" to the package root so that you can import, say, utilities with:
15
+
Here's what you need to know about how the files are structured in both git and in the published npm module:
17
16
18
-
```scss
19
-
@import"@primer/css/utilities/index.scss";
20
-
```
17
+
- In git, all of the SCSS source files live in the `src/` directory.
18
+
- When published, all of the files in `src/` are "hoisted" to the package root so that you can import, say, utilities with:
21
19
22
-
* All bundle interdependencies within Primer CSS are defined as relative imports (e.g. with `../`), so everything should work fine as long as the `@primer/css` directory is in one of your Sass include paths (i.e. `node_modules`).
20
+
```scss
21
+
@import'@primer/css/utilities/index.scss';
22
+
```
23
23
24
+
- All bundle interdependencies within Primer CSS are defined as relative imports (e.g. with `../`), so everything should work fine as long as the `@primer/css` directory is in one of your Sass include paths (i.e. `node_modules`).
24
25
25
26
## Install
27
+
26
28
Run `npm install` to install the npm dependencies.
27
29
28
30
## Docs site
31
+
29
32
The Primer CSS docs are built with React using [Doctocat](https://primer.style/doctocat) and automatically deployed on every push to this repo with [Now]. You can run the server locally with:
30
33
31
34
```sh
@@ -35,41 +38,43 @@ npm start
35
38
Then visit http://localhost:8000 to view the site.
36
39
37
40
### The docs directory
38
-
The [docs directory](../docs/) contains all of the documentation files in our docs site. Files are nested in the `/content` folder.
39
41
42
+
The [docs directory](../docs/) contains all of the documentation files in our docs site. Files are nested in the `/content` folder.
40
43
41
44
### Code blocks
45
+
42
46
All `html` fenced code blocks in `src/**/*.md` will be rendered as stories and listed under the relevant module's name in the left-hand nav. File changes should trigger a live reload automatically (after a brief delay).
43
47
44
48
## Storybook
45
49
46
-
Primer CSS Storybook is used for designing and prototyping components. Stories are written in HTML and leverage the Storybook API for configuring conditional logic.
50
+
Primer CSS Storybook is used for designing and prototyping components. Stories are written in HTML and leverage the Storybook API for configuring conditional logic.
47
51
48
52
```sh
49
53
npm run storybook
50
54
```
51
55
52
56
### The Storybook directory
57
+
53
58
Storybook configuration files live in [.storybook](../docs/.storybook). Addons and additional global config can be added to [main.js](../docs/.storybook/main.js) or [preview.js](../docs/.storybook/preview.js)
54
59
55
60
### Stories
61
+
56
62
Stories are individual `.jsx` or `.mdx` files that contain component HTML for prototyping, typically showcasing all possible variations of a component. Stories can be found in the [stories directory](../docs/src/stories/components) and are organized by component. Storybook will build and deploy a preview on any open Pull Request.
57
63
58
64
## Scripts
65
+
59
66
Our [`package.json`](package.json) houses a collection of [run-scripts] that we use to maintain, test, build, and publish Primer CSS. Run `npm run <script>` with any of the following values for `<script>`:
60
67
61
-
*`dist` runs `script/dist`, which creates CSS bundles of all the `index.scss` files in `src/`.
62
-
*`check-links` runs a link checker on your local development server (`localhost:3000`, started with `npm start`).
63
-
*`stylelint` lints the CSS source files.
64
-
*`eslint` lints the JavaScript source files.
65
-
*`now-build` and `now-start` are run on [Now] to build and start the docs site server. `now-test` runs them both in order.
66
-
*`start` runs the documentation site locally (alias: `dev`).
67
-
*`test` runs our test suite.
68
-
*`storybook` runs storybook local development server.
68
+
-`dist` runs `script/dist`, which creates CSS bundles of all the `index.scss` files in `src/`.
69
+
-`check-links` runs a link checker on your local development server (`localhost:3000`, started with `npm start`).
70
+
-`stylelint` lints the CSS source files.
71
+
-`eslint` lints the JavaScript source files.
72
+
-`start` runs the documentation site locally (alias: `dev`).
73
+
-`test` runs our test suite.
74
+
-`storybook` runs storybook local development server.
69
75
70
76
The above list may not always be up-to-date. You can list all of the available scripts by calling `npm run` with no other arguments.
0 commit comments