How to use the compile function from swig

Find comprehensive JavaScript swig.compile code examples handpicked from public code repositorys.

38
39
40
41
42
43
44
45
46
47
48
    filename: data.path,
  });
}


swigRenderer.compile = function(data, locals) {
  return swig.compile(data.text, {
    filename: data.path,
  });
};

fork icon3
star icon3
watch icon0

+ 3 other calls in file

3804
3805
3806
3807
3808
3809
3810
3811
3812
3813

/**
 * Compile string source into a renderable template function.
 *
 * @example
 * var tpl = swig.compile('{{ tacos }}');
 * // => {
 * //      [Function: compiled]
 * //      parent: null,
 * //      tokens: [{ compile: [Function] }],
fork icon0
star icon1
watch icon0

82
83
84
85
86
87
88
89
90
91
    };

extend(true, data, tplVars);

try {
    var tpl = swig.compile(String(file.contents), {filename: file.path});
    var compiled = tpl(data);

    file.contents = new Buffer(compiled);
    callback(null, file);
fork icon0
star icon0
watch icon0