Skip to content

Commit

Permalink
Merge pull request #2 from dadi/patch/clientside-compile
Browse files Browse the repository at this point in the history
Write compiled templates to client-side
  • Loading branch information
jimlambie authored Dec 19, 2017
2 parents 05d421b + 9b6b00b commit d2a9cca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ module.exports = () => {
debug('Starting Dust.js engine...')

this.additionalTemplates = options.additionalTemplates
this.compiledTemplates = {}
this.config = options.config
this.pagesPath = options.pagesPath
this.templates = options.templates
Expand Down Expand Up @@ -193,6 +194,8 @@ module.exports = () => {

const compiledData = dust.compile(data, name)

this.compiledTemplates[name] = compiledData

dust.loadSource(compiledData)

return true
Expand Down Expand Up @@ -260,7 +263,7 @@ module.exports = () => {
let templatesOutput = ''

templates.forEach(name => {
templatesOutput += dust.cache[name]
templatesOutput += this.compiledTemplates[name]
})

queue.push(
Expand Down

0 comments on commit d2a9cca

Please sign in to comment.