src/views/setup.js
function handlebars () {
	const Handlebars = require(ProyPath('node_modules', 'handlebars'));
	const layouts = require(ProyPath('node_modules', 'handlebars-layouts'));
	Handlebars.registerHelper(layouts(Handlebars));
	Handlebars.registerHelper('link', function (url, helper) {
		return makeLink(helper.data.root, url, helper.fn);
	});
	// Bundles
	Handlebars.registerHelper('bundle', function (bundle) {
		if (Kmetadata.bundles[bundle] === undefined) {
			return '';
		}
		return Kmetadata.bundles[bundle].toString();
	});
	// Localition
	Handlebars.registerHelper('i18n', _i18n);
	Handlebars.registerHelper('t', translate);
	const layoutFiles = glob(ProyPath('views', 'layouts', '*.handlebars')).concat(glob(ProyPath('koaton_modules', '**', 'views', 'layouts', '*.handlebars')));
	for (const file of layoutFiles) {
		Handlebars.registerPartial(basename(file).replace('.handlebars', ''), fs.readFileSync(file, 'utf8'));
	}
	return Handlebars;
}
function handlebars () {
	const Handlebars = require(ProyPath('node_modules', 'handlebars'));
	const layouts = require(ProyPath('node_modules', 'handlebars-layouts'));
	Handlebars.registerHelper(layouts(Handlebars));
	Handlebars.registerHelper('link', function (url, helper) {
		return makeLink(helper.data.root, url, helper.fn);
	});
	// Bundles
	Handlebars.registerHelper('bundle', function (bundle) {
		if (Kmetadata.bundles[bundle] === undefined) {
			return '';
		}
		return Kmetadata.bundles[bundle].toString();
	});
	// Localition
	Handlebars.registerHelper('i18n', _i18n);
	Handlebars.registerHelper('t', translate);
	const layoutFiles = glob(ProyPath('views', 'layouts', '*.handlebars')).concat(glob(ProyPath('koaton_modules', '**', 'views', 'layouts', '*.handlebars')));
	for (const file of layoutFiles) {
		Handlebars.registerPartial(basename(file).replace('.handlebars', ''), fs.readFileSync(file, 'utf8'));
	}
	return Handlebars;
}
function handlebars ( ) { const Handlebars = require ( ProyPath ( 'node_modules' , 'handlebars' ) ) ; const layouts = require ( ProyPath ( 'node_modules' , 'handlebars-layouts' ) ) ; Handlebars . registerHelper ( layouts ( Handlebars ) ) ; Handlebars . registerHelper ( 'link' , function ( url , helper ) { return makeLink ( helper . data . root , url , helper . fn ) ; } ) ; // Bundles Handlebars . registerHelper ( 'bundle' , function ( bundle ) { if ( Kmetadata . bundles [ bundle ] === undefined ) { return '' ; } return Kmetadata . bundles [ bundle ] . toString ( ) ; } ) ; // Localition Handlebars . registerHelper ( 'i18n' , _i18n ) ; Handlebars . registerHelper ( 't' , translate ) ; const layoutFiles = glob ( ProyPath ( 'views' , 'layouts' , '*.handlebars' ) ) . concat ( glob ( ProyPath ( 'koaton_modules' , '**' , 'views' , 'layouts' , '*.handlebars' ) ) ) ; for ( const file of layoutFiles ) { Handlebars . registerPartial ( basename ( file ) . replace ( '.handlebars' , '' ) , fs . readFileSync ( file , 'utf8' ) ) ; } return Handlebars ; }
Initialize layout support for handlebars, bundle helper, i18n helpers
@type {function} handlebars - returns the handlebars instance
Initialize layout support for handlebars bundle helper i18n helpers