better-stylekit v0.1.127
Better Stylekit
See usage
Better Stylekit example website
Installation
npm install better-stylekitContributing
Browser support
Stylekit components (CSS and JS) should work in following browsers:
- Chrome 58 or newer
- Safari 11 (Desktop), 11 and 10 for iOS (revisit in two months)
- Firefox 57 and newer
- Edge 16 and newer
CSS
- Use SUIT CSS naming conventions for CSS classes and component variables
- Use Bourbon mixins
JavaScript
- Assume ES6 environment
- Assume DOM4 environment
- Polyfill when in doubt
- Prefer leaving library integrations to the user rather than vendoring/bundling them
Components
- Make sure each component has at least one customizable
data-qaattribute- Put the qa attribute on the form element (
<select>,<input>, etc.) directly, if the component is simple - For complex components with multiple inputs, put the qa attribute on the parent and add non-customizable qa attributes for the child inputs. For example, if there is a two-choice toggle component, add a customizable qa attribute to the main parent element, and qa attributes like "choice-1", "choice-2" to the proper inputs.
- Put the qa attribute on the form element (
- Always include a
typefor<button>tags - Always include a
roleattribute where it makes sense - Sass mixins shared across different components should be in a shared file
- Set
sensitiveto add thebsk-Field--sensitiveclass so the field is obscured in FullStory:{{bsk-field sensitive=true ...}}
Usage
Using the stylekit as an artifact
npm installthe stylekit.- Add
stylekit/dist/*.css,stylekit/dist/*.js, andstylekit/fonts/*to your build pipeline. - Add
stylekit-web.cssorstylekit-web.min.cssto your page as a stylesheet. - Add
stylekit-web.jsorstylekit-web.min.jsto your page as a script. - Make sure the stylekit fonts are accessible under
fonts/in your CSS directory.
You can use the stylekit JS via the global BetterStylekit object.
Using the stylekit as a library
Ember
npm install ember-better-stylekitSee the ember-better-stylekit README for more details.
Components
| Component | HTML + CSS | JS | Ember | React |
|---|---|---|---|---|
| Button | ✔ | ✌ | ✔ | |
| Card | ✔ | ✌ | ✔ | |
| CardList | ✔ | ✔ | ||
| Dropdown | ✔ | ✌ | ✔ | |
| RadioList | ✔ | ✌ | ✔ | |
| Checkbox | ✔ | ✌ | ✔ | |
| Field | ✔ | ✔ | ||
| FieldSet | ✔ | ✔ | ✔ | |
| Range | ✔ | ✔ | ||
| Toggle | ✔ | ✌ | ✔ | |
| Tabs | ✔ | |||
| Modal |
✌ = not necessary
Development
BSKrefers to your local/stylekitESKrefers to your local/stylekit/ember-better-stylekitBetter Stylekitrefers to the published NPM package
IMPORTANT: CSS changes made in BSK do not automatically update the styles of ESK. ESK uses Better Stylekit for it's styling. In order to have BSK css changes propagate without having to publish to NPM check the Building CSS Changes section below.
Using BSK or ESK in Mortgage
- In order to access
BSKandESKin/mortgage/frontend, you will need to add symlinks: to set up: runmake add-bsk-esk-to-mortgage-symlinksinBSKto teardown: runmake rm-bsk-esk-to-mortgage-symlinksinBSK - The above commands will create symlinks to
BSKandESKin/mortgage/frontend/node_modules.
Building CSS changes
You will need to create a symlink in
/stylekit/ember-better-stylekit/node_modules/better-stylekitthat points to your localstylekit/src:- to set up: run
make add-bsk-to-esk-css-symlinkinBSK - to teardown: run
make rm-bsk-to-esk-css-symlinkinBSK
- to set up: run
Stylekit CSS changes should be picked up when you run
npm run buildinBSK- If you prefer a watcher, use
npm startinBSK
Test
- There are visual tests for components. The visual tests work this way:
- build the project, which creates previews of components
- use puppeteer to open the preview html and take a screenshot
- Use node-resemble-js to report any differences between the screenshot and a baseline screenshot
- A diff screenshot will be generated if necessary to highlight issues
- Since screenshots are os/browser dependent, the visual test will only pass in the docker environment
- To run the visual tests invoke
make testin the root of stylekit - When you add a new component, add a baseline screenshot and enable the component within the visual test
- When you change a component, update the baseline screenshot
- To add or update a baseline screenshot:
- run
make component=yourComponentName generate-baselinefor example:make component=dropdown generate-baseline - when that command is finished, you should see a new baseline screenshot in
stylekit/src/test/visual/baseline-screenshotthat you can check in
- run
Release
Automated
- Patch release:
make release - Minor release (rare):
make release-minor
Manual
- Commit all relevant changes
- Run
npm version patchornpm version minordepending on type of release - Run
npm installto ensure latest bundled deps are included - Run
npm run buildso the new version is baked in - Commit changes as the new version commit
- Login with
npm loginusing the better account (ask someone to share it with you via LastPass) - Run
npm publish
Roadmap
- Ability to add a message to a field
- Generic field set support
- Error state with clearable ability
- Document Field API
- Grid and form component
- Add /index.js and other root-level files to simplify library integration
- React/Preact library integration
- Consider Lerna for monorepo management
- Ember/Preact component generation from one source of truth
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago