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