UNPKG

1.08 kBJavaScriptView Raw
1var utils = require('../utils');
2const path = require('path');
3const basePath = process.cwd();
4
5function 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, // filename or glob pattern
15 this.contentCompiled = [], // compiled content
16 this.layoutSrc = config.layout ? path.join(this.meta.layouts, config.layout) : path.join(this.meta.layouts, 'default.ejs') , // path to template
17 this.compiled = '', // Final compiled page
18
19 this.fileDependencies = [], // array of all file deps
20 this.processor = config.processor || null // will content be run through a preprocessor
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
27module.exports = Page;
\No newline at end of file