@o2vend/theme-cli 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/liquid-engine.js +4 -2
package/package.json
CHANGED
package/src/lib/liquid-engine.js
CHANGED
|
@@ -132,7 +132,7 @@ async function renderWithLayout(liquid, templatePath, context, themePath) {
|
|
|
132
132
|
const layoutMatch = templateContent.match(/\{%\s*layout\s+['"](.+?)['"]\s*%\}/);
|
|
133
133
|
|
|
134
134
|
if (layoutMatch) {
|
|
135
|
-
const layoutPath = layoutMatch[1]; // e.g., 'theme'
|
|
135
|
+
const layoutPath = layoutMatch[1]; // e.g., 'layout/theme' or 'theme'
|
|
136
136
|
|
|
137
137
|
// Remove layout directive from template
|
|
138
138
|
const contentWithoutLayout = templateContent.replace(/\{%\s*layout\s+['"](.+?)['"]\s*%\}/, '').trim();
|
|
@@ -146,7 +146,9 @@ async function renderWithLayout(liquid, templatePath, context, themePath) {
|
|
|
146
146
|
content: renderedContent
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
// layoutPath already includes the full path from theme root (e.g., 'layout/theme')
|
|
150
|
+
// So we just need to add .liquid extension
|
|
151
|
+
const layoutFile = path.join(themePath, `${layoutPath}.liquid`);
|
|
150
152
|
if (fs.existsSync(layoutFile)) {
|
|
151
153
|
const layoutContent = fs.readFileSync(layoutFile, 'utf-8');
|
|
152
154
|
return await liquid.parseAndRender(layoutContent, layoutContext);
|