Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oc-template-jade module #375

Merged
merged 4 commits into from
Feb 1, 2017
Merged

oc-template-jade module #375

merged 4 commits into from
Feb 1, 2017

Conversation

nickbalestra
Copy link
Contributor

Done per jade what we did for handlebars in #371
To be rerun once oc-template-jade will be published

@nickbalestra nickbalestra changed the title using oc-template-jade for handling jade template business oc-template-jade module Jan 31, 2017
@nickbalestra nickbalestra removed the wip label Jan 31, 2017
Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of little things

compileDebug: false,
name: 't'
}).toString().replace('function t(locals) {', 'function(locals){');
preCompiledView = jade.precompile(template, { filename: viewPath });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would like to do something similar to the oc-client here rather than all the ifs. Something like

var precompilers = { jade, handlebars};
// and then
if(!precompilers[type]){
  throw strings.errors.cli.TEMPLATE_TYPE_NOT_VALID;
}
var preCompiledView = precompilers[type].precompile(template, { viewPath });

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, note that in jade we named that viewPath, not filename 👍

var context = { jade: require('jade/runtime.js')};
vm.runInNewContext(templateText, context);
template = context.oc.components[key];
template = jade.getPrecompiledTemplate(templateText, key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before here.

@nickbalestra
Copy link
Contributor Author

Updated.

Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only thing missing is the dep on the client/package.json. Sorry I missed it on my prev review

@nickbalestra
Copy link
Contributor Author

Should be fixed now

@matteofigus matteofigus merged commit 90c6554 into master Feb 1, 2017
@matteofigus matteofigus deleted the oc-template-jade branch February 1, 2017 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants