How to use the consolidate.render function in consolidate

To help you get started, we’ve selected a few consolidate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gd4Ark / fa-cli / lib / utils / install.js View on Github external
function logMessage(message, data) {
  if (!message) return
  render(message, data, (err, res) => {
    if (err) {
      console.error('\n   Error when rendering template complete message: ' +
          err.message.trim())
    } else {
      console.log('\n' +
          res
            .split(/\r?\n/g)
            .map(line => '   ' + line)
            .join('\n'))
    }
  })
}
github gd4Ark / fa-cli / src / utils / install.ts View on Github external
function logMessage(message: string, data: Obj): void {
  if (!message) return
  render(message, data, (err: any, res: string) => {
    if (err) {
      console.error('\n   Error when rendering template complete message: ' + err.message.trim())
    } else {
      console.log(
        '\n' +
          res
            .split(/\r?\n/g)
            .map(line => '   ' + line)
            .join('\n')
      )
    }
  })
}
github gd4Ark / fa-cli / lib / utils / install.js View on Github external
(key, next) => {
        const str = files[key].contents.toString()
        if (!/{{([^{}]+)}}/g.test(str)) {
          return next()
        }
        render(str, data, (err, res) => {
          if (err) {
            err.message = `[${key}] ${err.message}`
            return next(err)
          }
          if (key === '.easy-mock.js' && !data.easymock) {
            delete files[key]
            delete data.easymock
          } else {
            files[key].contents = Buffer.from(res)
          }
          next()
        })
      },
      done
github gd4Ark / fa-cli / src / utils / install.ts View on Github external
(key: number | string, next: any) => {
        const str = files[key].contents.toString()
        if (!/{{([^{}]+)}}/g.test(str)) {
          return next()
        }
        render(str, data, (err: any, res: any) => {
          if (err) {
            err.message = `[${key}] ${err.message}`
            return next(err)
          }
          if (key === '.easy-mock.js' && !data.easymock) {
            delete files[key]
            delete data.easymock
          } else {
            files[key].contents = Buffer.from(res)
          }
          next()
        })
      },
      done

consolidate

Modern and maintained fork of the template engine consolidation library. Maintained and supported by Forward Email <https://forwardemail.net>, the 100% open-source and privacy-focused email service.

MIT
Latest version published 5 months ago

Package Health Score

81 / 100
Full package analysis