If you're creating a new project from scratch, consider using sku, our officially supported front-end development toolkit. It's specially designed to get your project up and running as quickly as possible, while simplifying the process of keeping your development environment up to date.
If you'd instead like to work on a custom webpack project, you can use seek-style-guide-webpack to streamline the integration process.
StyleGuideProvider's props are used to set the page head properties using Helmet.
High Level Components
As much as possible, you should aim to minimise the amount of custom CSS you need to write. This is achieved by leveraging our suite of high level components, which are demonstrated on our style guide documentation site.
Low Level Styling
For more advanced pages, if you need to drop down into Less, the style guide provides a set of mixins and variables to make it easier to stay on brand.
In any style sheet that depends on the style guide, first import the Less theme by reference.
@import (reference) '~seek-style-guide/theme';
Responsive Breakpoint
The style guide exposes one responsive breakpoint:
@responsive-breakpoint: 740px;
Content should otherwise be responsive within its container. The set of included components follow this model internally if you'd like to get a sense of what this looks like in practice.
Color Variables
As much as possible, colors should be directly imported from the style guide.
The contrast ratio of certain foreground/background color combinations don't meet the AA accessibility standards that we aim for. As a result, a suite of accessible variants have been provided:
Please note that this list is not exhaustive, so contributions are encouraged. To validate color combinations, we recommend the use of the web-based tool Accessible Colors by @moroshko.
Grid Variables
In order to ensure elements correctly follow the grid, element sizing should always be controlled by the following variables:
Then, add seek-style-guide to the plugins list in your Babel config. For example, in .babelrc:
{
"plugins": ["seek-style-guide"]
}
Flow Type Checking
We've opted to include flow type checking in this project. If you're unfamiliar with static type checking you should start by reading React's overview.
This is completely opt-in and if you've decided not to use type checking in your project then there is nothing you need to do. It shouldn't impact your ability to include the style guide so long as you are using either sku or our webpack decorator.
Conversely, if you would like to opt-in to flow types you'll need to ensure that your .flowconfig includes a few exclusions and special options.
[ignore]
.*/node_modules/config-chain/.*
.*/node_modules/npmconf/.*
[include]
[libs]
[lints]
[options]
# This is required to prevent errors to less file imports
module.name_mapper.extension='less' -> '<PROJECT_ROOT>/no-declarations.js.flow'
# Good idea to ignore json too
module.name_mapper.extension='json' -> '<PROJECT_ROOT>/no-declarations.js.flow'
no-declarations.js.flow is just an empty file
Sketch asset generation
On every successful build (via npm test), asketch.json files (i.e. almost Sketch files) are generated by html-sketchapp containing document styles and symbols. These are provided via the following JSON files:
dist/asketch/document.asketch.json
dist/asketch/page.asketch.json
These can be manually imported into Sketch by downloading html-sketchapp and installing asketch2sketch.sketchplugin.
Once in Sketch, open the "Plugins" menu and select "From *Almost* Sketch to Sketch". Assuming you've run a full build of the style guide via npm test, you should now be able to select the asketch.json files in dist/asketch.
请发表评论