index.js
function templateFromFile(path) {
        // template source is a file name
        forcedTemplateName = 'singleton';
        if (cache.hasOwnProperty(templateSrc)) {
            registry.singleton = cache[templateSrc];
            return;
        }
        // Have to read this template for the first time
        var deferred = cache[templateSrc] = registry.singleton = new Deferred();
        fs.readFile(templateSrc, 'utf-8', function(err, data) {
            try {
                if (err) throw err;
                var template = compile({
                    data: data,
                    name: templateSrc,
                    path: templateSrc
                });
                deferred.resolve(template);
            } catch (err2) {
                // delete cache[templateSrc]; // Should we do this?
                deferred.reject(err2);
            }
        });
    }
function templateFromFile(path) {
        // template source is a file name
        forcedTemplateName = 'singleton';
        if (cache.hasOwnProperty(templateSrc)) {
            registry.singleton = cache[templateSrc];
            return;
        }
        // Have to read this template for the first time
        var deferred = cache[templateSrc] = registry.singleton = new Deferred();
        fs.readFile(templateSrc, 'utf-8', function(err, data) {
            try {
                if (err) throw err;
                var template = compile({
                    data: data,
                    name: templateSrc,
                    path: templateSrc
                });
                deferred.resolve(template);
            } catch (err2) {
                // delete cache[templateSrc]; // Should we do this?
                deferred.reject(err2);
            }
        });
    }
function templateFromFile ( path ) { // template source is a file name forcedTemplateName = 'singleton' ; if ( cache . hasOwnProperty ( templateSrc ) ) { registry . singleton = cache [ templateSrc ] ; return ; } // Have to read this template for the first time var deferred = cache [ templateSrc ] = registry . singleton = new Deferred ( ) ; fs . readFile ( templateSrc , 'utf-8' , function ( err , data ) { try { if ( err ) throw err ; var template = compile ( { data : data , name : templateSrc , path : templateSrc } ) ; deferred . resolve ( template ) ; } catch ( err2 ) { // delete cache[templateSrc]; // Should we do this? deferred . reject ( err2 ) ; } } ) ; }
Read single template from a file using the given file name
Read single template from a file using the given file name