file-interpolator

2.0.1 • Public • Published

Build Status Test Coverage Code Climate Issue Count dependencies Status devDependencies Status

file-interpolator

Interpolates a file using placeholders. The file may be interpolated with strings or the content of another file.

It might be useful for generating files using a template/layout. The memory footprint has been highly taken into account (I hope?), so it should handle really big files.

Example:

var interpolator = require('../');
var path = require('path');

var layout = path.join(__dirname, 'files/layout.hbs');
var partial = path.join(__dirname, 'files/partial.hbs');
var outputFile = path.join(__dirname, 'files/output.hbs');

interpolator(layout, [{
	replace: '{{{ content }}}',
	withFile: partial
}, {
	replace: '{{ bundle.js }}',
	with: 'script tag with the js bundle right here'
}, {
	replace: '{{ bundle.css }}',
	with: 'link tag with the css bundle right here'
}], outputFile).then(function(outputFile) {
	console.log('finished the inteprolation process.. outputfile:', outputFile);
});

Readme

Keywords

none

Package Sidebar

Install

npm i file-interpolator

Weekly Downloads

2

Version

2.0.1

License

Unlicense

Last publish

Collaborators

  • pantoninho