CR Styleguide
A Node-based project to supply Sass components and a styleguide generator.
To have a centralised hub supply common styling across Comic Relief products.
/dist/index.html
/dist/[project_name]/index.html
npm install @comicrelief/pattern-lab --save
on local scss file, add @import '~pattern-lab';
(or use includePaths: ['node_modules']
in grunt-sass options
configuration)
git clone https://github.com/comicrelief/pattern-lab ~/cr_root/pattern-lab
cd ~/cr_root/payin/web
yarn link-patternlab
npm install npm-link-local --global
and then e.g. npm-link-local ~/cr_root/pattern-lab
Either of the last 2 steps creates a symlink in the other project’s node_modules
, pointing to your local copy of pattern-lab
.
yarn watch
to liveload file changesyarn build
to generate all themes in the styleguideyarn build-base
to only generate the base theme in the styleguideyarn build-cr17
to only generate the cr17 theme in the styleguideyarn build-frost
to only generate the frost theme in the styleguideyarn build-payin
to only generate the payin theme in the styleguideyarn build-rnd17
to only generate the rnd17 theme in the styleguideyarn build-sr18
to only generate the sr18 theme in the styleguideyarn dev-server
or yarn watch
http://localhost:1337
to view styleguideGit commit messages are used to automatically publish a new version of npm package. To achieve this, every commit message should have a type and a message in the format described below.
Travis CI will run a job automatically after PR is merged and analyze all commit messages since last npm release. Then semantic-release plugin will calculate new version according to this result.
To avoid commit loops, version numbers are not committed back to package.json
. Versions are listed on GitHub releases and used in the modified package.json @comicrelief/pattern-lab">published to npm.
Commit messages are expected to be in this format:
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Minimally, only type
and subject
is required.
When there are no breaking changes or no new features. When we are fixing bugs or styles.
fix: A bug fix
When there is a new feature / functionality is added to the library
feat: A new feature
When there is a breaking change, we need to extend our commit message and add BREAKING CHANGE: A
description of the change
to its body. This message can be added to any type of commit.
Example:
feat: A new feature
BREAKING CHANGE: A description of the change
Commitizen library is added as npm dev dependency and it can be used to generate commit messages by
answering a few questions and skipping the ones which are not relavent.
Example workflow:
git add .
to add changed files and get ready to commityarn commit
This will start an interactive process to build commit message. Simply answer all questions or
press Enter
to skip.
Repeat and follow rest of the GitHub workflow
We are using Concourse CI and Travis CI to run tasks, and Netlify and Cloud Foundry to deploy pattern-lab.
When a pull request is created, it triggers a Netlify preview deployment, which is at
https://deploy-preview-[PULL_REQUEST_ID]--cr-pattern-lab.netlify.com/
Pull request commits and merge also trigger CI visual regression tests as explained below. Output is available at
https://ci.services.comicrelief.com/teams/main/pipelines/pattern-lab
test/visual/reference
.
"url": "dist/index.html",
yarn backstop-test-local
/tests/visual/html_report/index.html
in your browser.
yarn backstop approve