UNPKG

4.33 kBMarkdownView Raw
1# Welcome
2
3> It's dangerous to go alone. Here's a quick run through of optional post-install setup
4
5**Prerequisite:** Readme client side setup
6
7Assuming you have cloned the repo and done your first gulp, here are a few things you may need to do after initial setup.
8
9* [Adding a new component](#adding-a-new-component)
10* [Adding Project Credentials](#adding-project-credentials)
11* [Adding images](#adding-images)
12* [Adding custom fonts](#adding-custom-fonts)
13* [Setting the default development homepage](#setting-the-default-development-homepage)
14* [Pretty URLs](#pretty-urls)
15
16---
17
18##Adding a new component
19
20Handlebars allows seperate components/partials to be created. This approach allows the structure and the styles to be seperate and then included in the view files where needed.
21
22To create a new partial
23
24####The short way
25
26run `gulp component --name <component_name>`
27
28e.g. `gulp component --name newComponent`
29
30This will create the component folder, handlebars file and Sass file inside of `views/_partials`. Running `gulp` will including the Sass file - ready for styling.
31
32####The long way:
33
341. Inside of `views/_partials` folder, create a new folder with the name of the new partial e.g `newComponent`.
352. Inside of this new folder, `views/_partials/newComponent`, create two files.
36 * `newComponent.hbs` - the handlebars HTML file.
37 * `newComponent.scss` - the Sass file.
38 * Both of the above files follow the convention of being named the same as the folder. This makes it easier to find the partial files inside of a code editor.
393. At the top of the newly created Sass file, add a comment giving a small description of what the file is for. This is to ensure this Sass file is included in the build. An example of this would be `//styles for newComponent`. Running `gulp` will include the Sass file - ready for styling.
40
41To include the component in a view, include it by using the following code `{{> newComponent/newComponent }}`.
42
43Partials can be made a modular as required - allowing you to have a `button` and `input` partial, which are included in a `search` partial which itself is used in the `header` partial.
44
45##Adding Project Credentials
46
47`_config/creds.json` is a small file where anchillary project details are kept. These are used through the generator and include the following:
48
49* Site - the name of the site.
50* Author - the person or organisation that developed the site.
51* packageName - The name of the package which is used when creating a release zip file. It is recommended to include characters instead of spaces here e.g. "package-name" instead of "package name"
52
53##Adding images
54
55The directory `images` in the `_source` directory is copied over during the build process.
56
57This folder is copied to the `public` folder whenever the `gulp` task is run **and will need to be re-run when adding new images**
58
59When referencing images in the styles, reference them as:
60
61`url('/_client/images/<path>')`
62
63##Adding custom fonts
64
65Creating the directory `fonts` in the `_source` directory will mean that anything inside of this folder is copied over during the build process.
66
67This folder is copied to the `public` folder whenever the `gulp` task is run **and will need to be re-run when adding new images**
68
69When referencing fonts in the styles, reference them as:
70
71`/_client/fonts/<font-name>`
72
73##Setting the default development homepage
74
75By default, the development server directs to a placeholder index view if a view file cannot be found. To change this, in the file `main.js` change line 28 to be the view name that you want to act as the homepage / default. For example, changing it to the following will make the root level `styleguide.hbs` file act as the default homepage.
76
77```
78url = 'styleguide'
79```
80
81##Pretty URLs
82
83When developing views, by following a directory structure you can ensure URLs are displayed without the file extension both locally and on a remote server.
84
85An address such as `localhost/pretty-url` can be achieved by following the structure below
86
87```
88└── views/
89 └── pretty-url/
90 └── index.hbs
91```
92
93Similarily, `localhost/pretty-url/another-pretty-url` can be achieved via the following
94
95```
96└── views/
97 └── pretty-url/
98 └── index.hbs
99 └── another-pretty-url
100 └── index.hbs
101```
\No newline at end of file