diff --git a/src/lib/index.js b/src/lib/index.js index 4780c97..a980685 100644 --- a/src/lib/index.js +++ b/src/lib/index.js @@ -79,9 +79,7 @@ export function getProjectConfig(project) { return yaml.safeLoad(fs.readFileSync(configFile, 'utf8')) } -const TEMPLATES = [] -export function render(tmpl, data) { - if ( !TEMPLATES[tmpl] ) - TEMPLATES[tmpl] = template(fs.readFileSync(path.join(getStaticPath(), 'templates', tmpl), 'utf8')) - return TEMPLATES[tmpl](Object.assign({render}, data)) +export function render(templateName, data) { + const tmpl = template(fs.readFileSync(path.join(getStaticPath(), 'templates', templateName), 'utf8')) + return tmpl(Object.assign({render}, data)) } diff --git a/src/worker/tasks/project_deploy.js b/src/worker/tasks/project_deploy.js index 8f6b5e2..bf9b10b 100644 --- a/src/worker/tasks/project_deploy.js +++ b/src/worker/tasks/project_deploy.js @@ -46,12 +46,12 @@ function projectBuild({ project, settings }) { fs.writeFile( path.join(dest, 'index.html'), - render('embed.html.ejs', { config, content, project, embed_meta.fallbacks, slug, deploy_url }), + render('embed.html.ejs', { config, content, project, embed_meta, slug, deploy_url }), end) fs.writeFile( path.join(dest, 'preview.html'), - render('preview.html.ejs', { config, embed_code, project, embed_meta.fallbacks, slug, deploy_url }), + render('preview.html.ejs', { config, embed_code, project, embed_meta, slug, deploy_url }), end) fs.writeFile( @@ -61,7 +61,7 @@ function projectBuild({ project, settings }) { fs.writeFile( path.join(dest, 'oembed.json'), - render('oembed.json.ejs', { config, embed_code, project, embed_meta.fallbacks, slug, deploy_url }), + render('oembed.json.ejs', { config, embed_code, project, embed_meta, slug, deploy_url }), end) }) } diff --git a/static/templates/embed.html.ejs b/static/templates/embed.html.ejs index a8d8df7..ea8610f 100644 --- a/static/templates/embed.html.ejs +++ b/static/templates/embed.html.ejs @@ -2,51 +2,14 @@
+