- Install git and node
- Open a Terminal
cd
into whatever your project directory is- Pull down a copy of the project to your local machine:
git clone [email protected]:britannica/institutional-styleguide.git
- Change directory into the style guide project:
cd institutional-styleguide
- Install project dependencies:
npm install
- Open up a couple of Terminal tabs/windows (
Ctrl + T
) - Change directory into the style guide project:
cd institutional-styleguide
npm start
in one tab (Ctrl + C
to shut down the server)npm run watch
in the other tab (Ctrl + C
to stop watching files)- Navigate to
http://localhost:3000
in your browser
Open any .scss
file within the src
directory in a text editor of your choice. Atom is a popular,
free one. We use LivingCSS to generate our style guide, so I would recommend checking out their documentation
for full instructions on how to edit the CSS files.
There are essentially 4 different parts to edit within the CSS file:
- The description of the component, which is the stuff in the comments above the
@example
part - The
@example
in the comments - Configuration of the
@section
and@page
- The actual implementation of the styles
Developers will focus on the @example
, and the implementation details of the component.
Product and UX will focus on writing the description using Markdown.
/**
* Fancy component
*
* This is the section that product and ux will maintain. The first line, in this case "Fancy Component", will be used as
* the `@section` name.
*
* ### This is an `<h3>` using Markdown
*
* The description will end here since the next part is the `@example`.
*
* @example
* <button class="example-component">Example</button>
*
* @section
* @page Atoms
*/
.example-component {
/* implementation details */
}
With the npm run watch
task running, every time you save changes to .scss
files, a new guide will be generated.
If you want to manually rebuild the style guide, you can run the following task:
npm run guide:build
After you've verified your changes, it's time to commit and push them back to the GitHub repo.
If you're using GitHub Desktop (recommended for non-developers):
- See their documentation on Committing and reviewing changes to your project
If you're using git:
git commit -am "A description of the changes you made"
- If this is the first push, you'll need to set the upstream branch:
git push -u origin master
- On every subsequent push:
git push origin master
Within your project, run:
npm install --save @britannica/institutional-styleguide
More docs to come...