-
Notifications
You must be signed in to change notification settings - Fork 8
Working on the Project
When working on the main site, utilize the Angular CLI as much as possible. This is to ensure your code is scaffolded properly.
Files names should be kebab-case. Sass files should be prepended with an underscore (_).
This mini-guide explains the workflow and commands you'll use to contribute to the main site. If you want to know more about what these commands do the Angular docs are a great reference for this section. The basic building blocks of Angular are components, services and directives. You can use the Angular CLI to generate these files in the current directory you're in.
ng g[enerate] component/service/directive # the [enerate] part is optional, so `ng g component` generates a new component- Adding
-hwill print out the help instructions. - Adding
--dry-runwill tell you what files it will create/edit, but not do it.
ng generate component <name> --dry-run
For example, if you're working on a new component, you would do:
cd src/<path/to/parent/folder> my-component # Make sure you're in the parent folder that you want to generate the component in
ng g[enerate] c[omponent] my # The `ng g c` is equivalent to `ng generate component`This will generate the classic trio and a test file inside the folder src/<path/to/parent/folder>/my-component/
-
my-component.component.htmlTemplate (HTML) -
my-component.component.scssStylesheet (CSS) -
my-component.component.tsController (TypeScript) -
my-component.component.spec.tsTest file
Now you can import this component into other components.
Depending on what you're doing, you'll most likely be creating a trio of HTML/CSS/JavaScript files and placing them in public/<feature>. Read the feature specification/issue to figure out what needs to be done and if there is any confusion just ask!