INNER CODE UNIT · JavaScript

partials

codeceptjs/CodeceptJS · Bunoshfile.js:176

  const partials = fs.readdirSync('docs/webapi').filter(f => path.extname(f) === '.mustache')
  const placeholders = partials.map(file => `{{> ${path.basename(file, '.mustache')} }}`)
  const templates = partials
    .map(file => fs.readFileSync(`docs/webapi/${file}`).toString())
    .map(template =>
      template
        .replace(/^/gm, '   * ')
        .replace(/^/, '\n')
        .replace(/\s*\* /, ''),
    )

  for (const file of files) {
    const name = path.basename(file, '.js')
    say(`Building helpers with docs for ${name}`)
    copyFile(`lib/helper/${file}`, `docs/build/${file}`)
    replaceInFile(`docs/build/${file}`, cfg => {
      for (const i in placeholders) {
        cfg.replace(placeholders[i], templates[i])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…