MCPcopy Index your code
hub / github.com/Shopify/function-examples / expandLiquidTemplates

Function expandLiquidTemplates

util/expand-liquid.js:14–27  ·  view source on GitHub ↗
(template, liquidData)

Source from the content-addressed store, hash-verified

12import { exec } from 'child_process';
13
14async function expandLiquidTemplates(template, liquidData) {
15 const entries = await glob([path.join(template, "**/*.liquid")], {
16 dot: true,
17 ignore: ["**/node_modules"],
18 });
19
20 for (const entry of entries) {
21 const engine = new Liquid();
22 const rendered = await engine.renderFile(entry, liquidData);
23 const outputPath = entry.replace(".liquid", "");
24 await fs.writeFile(outputPath, rendered);
25 console.log(` ${path.relative(process.cwd(), outputPath)}`);
26 }
27}
28
29async function expandAppLiquidTemplates(appDir) {
30 const samplePath = path.join(process.cwd(), appDir);

Callers 2

expandAppLiquidTemplatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected