How to use the render function from consolidate
Find comprehensive JavaScript consolidate.render code examples handpicked from public code repositorys.
GitHub: aosqy/asqy-cli
194 195 196 197 198 199 200 201 202 203
// 文件是.js或者.json才是模板引擎 if (file.includes('.js') || file.includes('.json')) { let content = files[file].contents.toString(); //文件内容 // 我们将ejs模板引擎的内容找到 才编译 if (content.includes('<%')) { content = await render(content, res); files[file].contents = Buffer.from(content); //渲染 } } })
0
0
0
+ 151 other calls in file
GitHub: Tencent/wepy
177 178 179 180 181 182 183 184 185 186
const str = files[file].contents.toString(); // do not attempt to render files that do not have mustaches if (!/{{([^{}]+)}}/g.test(str)) { return next(); } handlebars.render(str, metalsmithMetadata, (err, res) => { if (err) { err.message = `[${file}] ${err.message}`; return next(err); }
0
0
725
+ 11 other calls in file
consolidate.render is the most popular function in consolidate (164 examples)