render-in-place
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

🎞 render-in-place

Render an ejs templated file, overwriting it with the result.

Usage

Import

This module exposes a function as its default export.

CommonJS

const render = require('render-in-place').default;
 
render(...)

TypeScript

With allowSyntheticDefaultImports

import render from 'render-inplace';
 
render(...)

Without allowSyntheticDefaultImports

import { default as render } from 'render-in-place';
 
render(...)
 
// or
 
import * as rip from 'render-in-place';
 
rip.render(...)

Example

import render from 'render-in-place';
 
render(
    '/path/to/template', // path to template file
    { data: { to: 'render' } }, // data passed to template
    {
        read: {}, // config passed to ejs reading file
        write: {}, // config passed to fs when writing file
    },
)

Documentation

render(path: string, data: object, config: object)

path

The absolute path to your template file.

data

Any data to pass off to the template when rendering. This value is provided directly to ejs when rendering your file.

config

Extra configuration provided to ejs.renderFile or fs.writeFile.

config.read

Configuration passed to ejs.renderFile.

config.write

Configuration passed to fs.writeFile.

Readme

Keywords

none

Package Sidebar

Install

npm i render-in-place

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

9.37 kB

Total Files

11

Last publish

Collaborators

  • jakehamilton