You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
built in modular way. That makes it awesomely easy to scale, modify and maintain.
14
18
### Main features
15
19
20
+
* HTML5 + CSS3 with FlexBox
21
+
* jQuery
22
+
* Bootstrap4
23
+
* SASS
24
+
* Hanldebars with layouts
25
+
* Gulp
26
+
* Bower
27
+
16
28
### Other versions
17
29
18
30
This is the HTML version, which is great for enhancing and integrating it into other platforms and environments.
@@ -149,7 +161,7 @@ In this folder are located files related to our application building. That can b
149
161
Compiled state of our app with processed styles, templates, scripts and assets.
150
162
151
163
**Warning! Never work inside this folder, because your changes would be overwritten on every build**
152
-
164
+
pu
153
165
154
166
## File Types
155
167
@@ -159,7 +171,7 @@ Our app consists of different file types.
159
171
160
172
We use [SASS](http://sass-lang.com/) as CSS preprocessor language.
161
173
Main variables are defined in ```src/_variables.scss``` folder.
162
-
For making life easier we broke down styles into components, and on build we're just merging all ```.scss``` files together and processing it to ```pubilc/css/app.css``` file. Style files are merged in following order
174
+
For making life easier we broke down styles into components, and on build we're just merging all ```.scss``` files together and processing it to ```dist/css/app.css``` file. Style files are merged in following order
163
175
164
176
```
165
177
{variables.scss}
@@ -173,13 +185,63 @@ There are also different theme variations located in ```src/_themes/``` folder,
173
185
174
186
#### Scripts (*.js)
175
187
188
+
We separate application's scripts across it's components. For simplicity we use ES5 in this version and just wrap each component's script in jQuery ```$(function() { })```. JS configurations are defined in ```src/config.js``` file. On build application script files are merged together and copied to ```dist/js/app.js``` fole. Script files are merged in following order
189
+
190
+
```
191
+
{config.js}
192
+
{all .js files except main.js}
193
+
{main.js}
194
+
```
195
+
176
196
#### Templates (*.hbs)
177
197
198
+
Templates are pieces of HTML files written in template engine language. We use [Handlebars](http://handlebarsjs.com/), which allows to have conditions in HTML, reuse partials in different pages (e.g. sidebars, footers), use loops, layouts etc.
199
+
178
200
#### Pages (*-page.hbs)
179
201
202
+
Templates themselves are just parts of markup, and aren't compiled as separate files. What we really want in final output is ```.html``` page in ```dist/``` folder. For that reason there are special handlebar templates which filenames end with ```-page.hbs```. Each ```{pagename}-page.hbs``` file would be compiled to ```dist/{pagename}.html``` page with flatened file structure.
203
+
204
+
Pages can consist of different templates (partials) which can be included thanks to handlebars partial including. Also each page have it's context which is data passed into template on rendering. That data is used in template expressions and variables. page contexts can be defined in two ways:
and **_context.js** files ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/_context.js)).
218
+
```
219
+
module.exports = {
220
+
foo: 'bar',
221
+
foo2: function() {
222
+
// do some magic, return some string
223
+
},
224
+
list: [
225
+
'One', 'Two', 'Three'
226
+
]
227
+
}
228
+
```
229
+
230
+
The final result of page context is compination of both ways. Moreover, different depth level _context.js files are extending each other and then are extended with YAML headers data. In our case we have ```src/_context.js``` file, where main website properties are defined and YAML headers in ```*-page.hbs``` files.
231
+
180
232
#### Layouts (*-layout.hbs)
181
233
182
-
#### Contexts (_context.js)
234
+
If different pages have lot of common components like sidebar, header, footer, It's a good idea to define a layout for those common pages and define in page files only the content which is unique.
235
+
236
+
Layout is a page content wrapper. If the page has layout in output we'll get page's content inserted into layout. Layouts should have ```{{{body}}}``` handlebars tag, which is entry point for page content. ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/app/app-layout.hbs))
237
+
238
+
To define a page layout you need to specify page file context's ```layout``` variable. It can be done both by YAML header or _context.js file. ([example](https://github.com/modularcode/modular-admin-html/blob/master/src/app/forms/forms-page.hbs))
239
+
240
+
If you need more advanced layouting you can use [handlebar-layouts](https://www.npmjs.com/package/handlebars-layouts) helper approach, which is also available out of the box.
241
+
242
+
#### Vendor files
243
+
244
+
Except application files there are also third party plugin files (e.g. Bootstrap). They are managed by using [Bower](http://bower.io/). Usually vendor libraries consist from scripts, styles and assets (images, fonts). The build system will concatenate and copy all script and style files correspondingally to ```dist/js/vendor.js```and ```dist/css/vendor.css``` also will copy all assets to ```dist/assets/``` folder.
0 commit comments