Skip to content

pantoninho/file-interpolator

Repository files navigation

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);
});

About

Interpolates two files using a placeholder

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published