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

[WIP] Use partialIndent hbs option to prevent indent issues #5053

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/server/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ function activateTheme(activeTheme) {
blogApp.cache = {};

// set view engine
hbsOptions = {partialsDir: [config.paths.helperTemplates]};
hbsOptions = {
partialsDir: [config.paths.helperTemplates],
// override the default compile
onCompile: function(exhbs, source, filename) {
var options;
if (filename && filename.indexOf('partials') !== -1) {
options = {preventIndent: true};
}

return exhbs.handlebars.compile(source, options);
}
};

fs.stat(themePartials, function (err, stats) {
// Check that the theme has a partials directory before trying to use it
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"connect-slashes": "1.3.0",
"downsize": "0.0.8",
"express": "4.12.0",
"express-hbs": "0.7.11",
"express-hbs": "0.8.2",
"extract-zip": "1.0.3",
"fs-extra": "0.13.0",
"glob": "4.3.2",
Expand Down