main
HerrHase 1 year ago
parent 976fd82132
commit e06ff2d08d

@ -46,12 +46,12 @@ class Engine {
}, true) }, true)
// adding defaults for view, data from site.yml, functions and pageQuery // adding defaults for view, data from site.yml, functions and pageQuery
this._defaults = { this._defaults = assign(this._options.defaults, {
site: site, site: site,
asset: asset, asset: asset,
dayjs: dayjs, dayjs: dayjs,
pageQuery: new PageQuery(configStore.get('source')) pageQuery: new PageQuery(configStore.get('source'))
} })
} }
/** /**
@ -77,7 +77,7 @@ class Engine {
const options = configStore.get('options') const options = configStore.get('options')
// if options minifyHtml is set, minify html, but only if page has type html // if options minifyHtml is set, minify html, but only if page has type html
if (options.minifyHtml === true && data.page.type === 'html') { if (options.minifyHtml === true && data.page.extensions === 'html') {
response = minify(response, { response = minify(response, {
removeComments: true, removeComments: true,
collapseWhitespace: true, collapseWhitespace: true,
@ -96,4 +96,4 @@ class Engine {
} }
module.exports = Engine module.exports = Engine

@ -28,6 +28,7 @@ class Blocks {
this._dirPath = dirPath this._dirPath = dirPath
// if filename is not index.md add filename to path
if (filename !== 'index.md') { if (filename !== 'index.md') {
this._dirPath += '/' + filename this._dirPath += '/' + filename
} }

@ -36,9 +36,15 @@ class Siteomat {
throw new Error('Destination is undefined') throw new Error('Destination is undefined')
} }
this._options = assign({
'defaults': {
}
}, options)
this._source = source this._source = source
this._views = views this._views = views
this._destination = options.destination this._destination = this._options.destination
// fill singleton for configuration // fill singleton for configuration
configStore.set('source', source) configStore.set('source', source)
@ -63,7 +69,9 @@ class Siteomat {
configStore.set('site', this._site) configStore.set('site', this._site)
this._engine = new Engine(views, this._site) this._engine = new Engine(views, this._site, {
'defaults': this._options.defaults
})
} }
/** /**

Loading…
Cancel
Save