Fix handlebars path issue on Windows OS.
This commit is contained in:
@@ -77,7 +77,7 @@ app.get('/', async (req, res) => {
|
|||||||
|
|
||||||
data.helpers = {
|
data.helpers = {
|
||||||
port,
|
port,
|
||||||
include_partial: (filesPath) => path.join(modulesPath, filesPath),
|
include_partial: (filesPath) => handlebarLayoutsPath(modulesPath, filesPath),
|
||||||
baseView,
|
baseView,
|
||||||
previewFrameUrl: `${previewFrameUrl}/${baseViewUrl}`,
|
previewFrameUrl: `${previewFrameUrl}/${baseViewUrl}`,
|
||||||
}
|
}
|
||||||
@@ -95,8 +95,8 @@ app.get('/view/:baseView', async (req, res) => {
|
|||||||
const blockName = config.has('blockName') ? config.get('blockName') : developmentBlockName;
|
const blockName = config.has('blockName') ? config.get('blockName') : developmentBlockName;
|
||||||
|
|
||||||
data.helpers = {
|
data.helpers = {
|
||||||
include_partial: (filesPath) => path.join(modulesPath, filesPath),
|
include_partial: (filesPath) => handlebarLayoutsPath(modulesPath, filesPath),
|
||||||
include_block_template: () => path.join(projectPath, 'src', `${blockName}.template`),
|
include_block_template: () => handlebarLayoutsPath(projectPath, 'src', `${blockName}.template`),
|
||||||
section_class: `${blockName}--${jsonFileName}`,
|
section_class: `${blockName}--${jsonFileName}`,
|
||||||
base_url: '/'
|
base_url: '/'
|
||||||
}
|
}
|
||||||
@@ -396,3 +396,8 @@ function handleSyntaxErrors(err, req, res, next) {
|
|||||||
|
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handlebarLayoutsPath() {
|
||||||
|
return path.join(...arguments)
|
||||||
|
.replace(/\\/g, '/'); // Windows path issue. Fix all "\" for Handlebars.
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user