1 | _ = require('lodash')
|
2 | getConfig = require('./config')
|
3 | SwigHelper = require('./swig-helper')
|
4 | HbHelper = require('@resin.io/doxx-handlebars-helper')
|
5 | LunrSearch = require('./lunr-search')
|
6 | Nav = require('./nav')
|
7 |
|
8 | Doxx = (config) ->
|
9 | if not (this instanceof Doxx)
|
10 | return new Doxx(arguments...)
|
11 |
|
12 | this.config = getConfig(config)
|
13 | return
|
14 |
|
15 | Doxx::build = require('./build')
|
16 |
|
17 | Doxx::navParse = ->
|
18 | Nav.parse(this.config)
|
19 | Doxx.navPP = Nav.pp
|
20 |
|
21 | Doxx::configureExpress = (app) ->
|
22 | SwigHelper.configureExpress(app, this.config)
|
23 |
|
24 | Doxx::getLocals = ->
|
25 | layoutLocals = this.config.layoutLocals
|
26 | return _.assign {}, layoutLocals, arguments...
|
27 |
|
28 | Doxx::loadLunrIndex = ->
|
29 | LunrSearch.loadIndex(this.config)
|
30 |
|
31 | Doxx::lunrSearch = LunrSearch.search
|
32 |
|
33 | Doxx.Handlebars = HbHelper.Handlebars
|
34 | Doxx.swig = SwigHelper.swig
|
35 |
|
36 | module.exports = Doxx
|