How to use the precompile function from swig
Find comprehensive JavaScript swig.precompile code examples handpicked from public code repositorys.
3700 3701 3702 3703 3704 3705 3706 3707 3708 3709
/** * Pre-compile a source string into a cache-able template function. * * @example * swig.precompile('{{ tacos }}'); * // => { * // tpl: function (_swig, _locals, _filters, _utils, _fn) { ... }, * // tokens: { * // name: undefined,
0
1
0
28 29 30 31 32 33 34 35 36 37
this.files.forEach(function(f) { var src = f.src; var dest = f.dest.replace('.twig', '.js'); var contents = grunt.file.read(f.src); var _tpl = swig.precompile(contents, {}).tpl.toString().replace('anonymous', ''); _tpl = 'define(function () { return ' + _tpl + '; });'; // Handle options.
0
0
0
+ 2 other calls in file
swig.compileFile is the most popular function in swig (1638 examples)