-
Notifications
You must be signed in to change notification settings - Fork 55
Creating a New Component
Jenna Badanowski edited this page Apr 24, 2019
·
2 revisions
Each component requires several files.
Assuming "foo" is the component, the following are created:
-
src/styles/foo.scssis a SASS template with an example BEM structure, includes sample elements and states -
src/styles/components.scssis appended with@import "components/foo.scss" -
test/templates/foo/data.jsondefines properties, modifiers, states and aria options (i.e., a primitive schema) for the component -
test/templates/foo/component.njkis Nunjucks macro with a basic constructor -
test/templates/foo/index.njkimports above macro and data file to output the base component
Read more about the
testframework and Visual Testing
Run npm run start:playground. Navigate to localhost:3030/foo to see the page.
Note: The server must be restarted if
data.jsonchanges.