1
1
mirror of https://github.com/primer/css.git synced 2024-11-23 20:38:58 +03:00
The CSS design system that powers GitHub
Go to file
2019-02-04 13:28:41 -08:00
.github nix release docs in .github/CONTRIBUTING 2018-10-18 15:18:19 -07:00
.storybook fix bad merge 2018-10-17 14:58:35 -07:00
alerts refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
avatars refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
base refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
blankslate refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
box refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
branch-name refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
breadcrumb refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
buttons refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
core refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
docs chore: fix path to docs/utils.js in comment 2019-02-04 13:28:09 -08:00
docs-test chore: move all the docs stuff up 2019-02-04 12:55:18 -08:00
forms refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
labels refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
layout refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
lib chore: nix resolve alias for primer/index.scss 2019-02-04 13:23:49 -08:00
markdown refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
marketing refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
modules refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
navigation refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
pages chore: fix SCSS path 2019-02-04 13:28:41 -08:00
pagination refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
popover refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
product refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
progress refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
script chore: move primer build script up 2019-02-04 13:02:11 -08:00
static chore: move all the docs stuff up 2019-02-04 12:55:18 -08:00
subhead refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
support refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
table-object refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
tests fix broken year tests 2019-01-04 10:38:05 -08:00
tools/stylelint-selector-no-utility chore: rm -r tools/stylelint-config-primer 2019-02-04 12:37:00 -08:00
tooltips refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
truncate refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
utilities refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
.gitignore chore: qualify "build/" in .gitignore 2019-02-04 13:07:06 -08:00
.npmignore Auto building on publish, and including build dir in npm package 2016-06-02 09:39:45 -04:00
.npmrc kill the package-lock.json files 2018-11-13 15:22:23 -08:00
.stylelintrc.json Moving .stylelintrc.json to root 2017-07-26 15:14:47 -07:00
.travis.yml ci: move selector-diff-report into script list 2019-01-25 14:48:54 -08:00
CHANGELOG.md chore: update CHANGELOG.md for 11.0.0 2019-01-25 15:43:43 -08:00
CODE_OF_CONDUCT.md add code of conduct 2018-12-04 15:34:29 -05:00
DEVELOP.md docs: scrub references to scripts in DEVELOP.md 2019-02-04 12:26:35 -08:00
index.scss refactor: git mv modules/primer/* . 2019-02-04 13:15:35 -08:00
LICENSE Happy new year 2018-01-03 15:05:16 -08:00
next.config.js chore: move all the docs stuff up 2019-02-04 12:55:18 -08:00
now.json chore: refactor now.json 2019-02-04 13:28:23 -08:00
package-lock.json chore: rebuild package-lock 2019-02-04 13:01:39 -08:00
package.json chore: move @primer/css metadata to package.json 2019-02-04 13:01:34 -08:00
README.md docs: merge modules/primer/README and DOCS.md into README.md 2019-02-04 13:14:07 -08:00
RELEASING.md docs: update RELEASING.md 2019-02-04 12:27:08 -08:00

Primer

npm version

Primer CSS is the Sass implementation of Primer, the design system that powers GitHub.

Install

This repository is distributed with npm. After installing npm, you can install @primer/css with this command.

$ npm install --save @primer/css

Usage

The included source files are written in Sass with the SCSS syntax. After installing with npm, you can add your project's node_modules directory to your Sass include paths (AKA load paths in Ruby), then import it like this:

@import "@primer/css/index.scss";

You can import individual Primer modules directly from the @primer/css package:

Then, you would import the module with:

@import "@primer/css/core/index.scss";
@import "@primer/css/product/index.scss";
@import "@primer/css/marketing/index.scss";

Development

See DEVELOP.md for development docs.

Releasing (Staff only)

You can find docs about our release process in RELEASING.md.

Documentation

The Primer CSS documentation site is created with Next and hosted on [Now].

Running the site

Once you've cloned this repo and run npm install, you can start the site with:

npm start

This should start up the Next dev server and a background task that will keep the pages directory up-to-date whenever you change the source files in modules/primer*.

Syncing the docs

If, for whatever reason, the dev server isn't syncing files, you have two choices:

  1. Stop the server (ctrl-C) and restart it (npm run dev), which will re-sync the files and clear Next's cache.

  2. Run script/sync manually:

    # in the docs directory
    script/sync
    

    If you find yourself needing to do this often, please file an issue and tag @shawnbot. 🙇

The pages directory

The pages directory contains all of the files that map to URLs on the site. Because we plan to host the site at primer.style/css (and because of the way that Now's path aliasing feature works), we nest all of our documentation under the additional css directory.

The sync task maintains a listing of files that it's copied from the modules directory in pages/css/.gitignore, which ensures that none of these files are checked into git.

Sync internals

We use Metalsmith to sync the source docs to the pages directory and transform them in the following ways:

  1. We filter the list of files to only Markdown documents and package.json files
  2. Many package README.mds wrap the actual documentation content in <!-- %docs --> HTML comments that usually include YAML frontmatter. In these instances, we extract the content that portion and reformat the frontmatter.
  3. We filter out any Markdown files that don't include a path frontmatter key, and rename the destination file to match the path (e.g. path: foo/bar writes to pages/css/foo/bar.md).
  4. We set the source frontmatter key to a fully-qualified github.com URL for the source file so that we can link directly to it.
  5. A limited list of fields for all packages is extracted into a single file (pages/css/packages.json), which serves as a light-weight dependency graph.
  6. We read the changelog and write it to whats-new/changelog.md with some additional frontmatter.
  7. We read the list of files from pages/css/.gitignore and delete them from the filesystem, then write the new list of paths so that they aren't committed to git.

All of the logic for syncing the source docs (and transforming them in transit) is controlled in lib/sync.js, and each "step" in the transformation (as well as the watching) is implemented as a Metalsmith plugin.

Why Metalsmith? We're glad you asked! @shawnbot likes the simplicity of Metalsmith's core and how easy it is to write powerful plugins.

License

MIT © GitHub