1 | var utils = require('../utils');
|
2 | const path = require('path');
|
3 | const basePath = process.cwd();
|
4 |
|
5 | function Page (config, meta, parentKey) {
|
6 | this.meta = meta;
|
7 |
|
8 | this.key = utils.getKey(config.title);
|
9 | this.parentKey = parentKey || null;
|
10 | this.title = utils.titlefy(config.title),
|
11 | this.filename = `${utils.getKey(config.title)}.html`,
|
12 | this.path = this.parentKey ? `${this.parentKey}/${this.filename}` : this.filename,
|
13 |
|
14 | this.contentSrc = config.content,
|
15 | this.contentCompiled = [],
|
16 | this.layoutSrc = config.layout ? path.join(this.meta.layouts, config.layout) : path.join(this.meta.layouts, 'default.ejs') ,
|
17 | this.compiled = '',
|
18 |
|
19 | this.fileDependencies = [],
|
20 | this.processor = config.processor || null
|
21 | this.bootstrap = {
|
22 | key: config.bootstrap ? path.basename(config.bootstrap, '.js') : null,
|
23 | path: config.bootstrap ? path.join(basePath, config.bootstrap) : null
|
24 | }
|
25 | }
|
26 |
|
27 | module.exports = Page; |
\ | No newline at end of file |