How to use the compileFile function from swig
Find comprehensive JavaScript swig.compileFile code examples handpicked from public code repositorys.
GitHub: alexbain/lirc_web
12 13 14 15 16 17 18 19 20 21 22 23
var macros = require('./lib/macros'); // Precompile templates var JST = { index: swig.compileFile(__dirname + '/templates/index.swig'), appcache: swig.compileFile(__dirname + '/templates/appcache.swig'), }; // Set bootup time as the cache busting hash for the app cache manifest var bootupTime = Date.now();
61
126
0
GitHub: digital-flowers/elegant
82 83 84 85 86 87 88 89 90 91
if (this.view) { if (!config.STATIC.CACHE_HTML) { swig.invalidateCache(); } data = swig.compileFile(this.view.index)(this.view.vars); var dontCompress = (config.STATIC.COMPRESS_HTML_EXCEPTION.indexOf(this.PATH) >= 0) || (this.PATH == "" && config.STATIC.COMPRESS_HTML_EXCEPTION.indexOf("/") >= 0); if (config.STATIC.COMPRESS_HTML && !dontCompress) {
4
11
8
GitHub: 5orenso/simple-blog
493 494 495 496 497 498 499 500 501 502
function renderPage(req, res, content, template) { // eslint-disable-next-line let requestPathname = template || req._parsedUrl.pathname; try { const tpl = swig.compileFile(templatePath + requestPathname); res.send(tpl(Object.assign({ now: Math.round((new Date()).getTime() / 1000), cookies: req.cookies, signedCookies: req.signedCookies,
3
7
4
+ 62 other calls in file
GitHub: a932455223/WebMaker
148 149 150 151 152 153 154 155 156 157
} var result = yield request('http://www.yst.com.cn/pc/security/landing/goods/'+products.join(',')); console.log('http://182.254.222.64/pc/security/landing/goods/'+products.join(',')); page[i] = result.body; } var compile = swig.compileFile(tmplPath); var data; if(typeof page[i] === 'string'){ data = JSON.parse(page[i]); }else{
2
3
0
64 65 66 67 68 69 70 71 72 73
config.configureSwig(swig); config.configureSwig(markedSwig); glob.sync(config.templates, {cwd: config.cwd}).forEach(function(file) { var absfile = path.resolve(config.cwd, file); templates[file] = swig.compileFile(absfile); }); return through(function(tree, enc, done) { if (!(tree instanceof Node)) { this.push(tree); return done(); }
1
2
3
GitHub: FWeinb/SassDoc
195 196 197 198 199 200 201 202 203 204
* @param {Array} data * @param {String} destination * @param {Object} options */ generate: function (data, destination, options) { var template = swig.compileFile(__dirname + '/../templates/docs.html.swig'); options.data = data; return exports.file.create(destination, template(options));
62
0
2
GitHub: genify/nei
86 87 88 89 90 91 92 93 94 95
_fs.lsfile(this.options.tplRoot, (name, file) => { logger.log('debug', { data: [file], message: 'complie template %s' }); this.templates[file] = swig.compileFile(file, {autoescape: !1}); }); } /**
4
25
3
3873 3874 3875 3876 3877 3878 3879 3880 3881 3882
* // } * tpl({ tacos: 'Tacos!!!!' }); * // => Tacos!!!! * * @example * swig.compileFile('/myfile.txt', { varControls: ['<%=', '=%>'], tagControls: ['<%', '%>']}); * // => will compile 'myfile.txt' using the var and tag controls as specified. * * @param {string} pathname File location. * @param {SwigOpts} [options={}] Swig options object.
0
1
0
+ 3 other calls in file
GitHub: waleeakhter/apply-insure
994 995 996 997 998 999 1000 1001 1002
"-" + insurence_want.getFullYear(); } // total_data.personData[0].birthday = total_data.personData[0].birthday; const detailsEmailTemplate = swig.compileFile("details_email.twig"); const html1 = detailsEmailTemplate(total_data); fs.writeFileSync("./detailsEmailTemplate123.html", html1);
0
0
1
+ 780 other calls in file
954 955 956 957 958 959 960 961 962
Object.assign(total_data, {agentEmail}); Object.assign(total_data, {agentPhone}); Object.assign(total_data, {agentSubject}); total_data.applicant_email_content = total_data.applicant_email_content.split("<br>").join("\n"); const thankyouTemplate = swig.compileFile('thankyou.twig'); const html2 = thankyouTemplate(total_data); let additional_email = total_data.agent['additional_email'].trim() != "" ? total_data.agent['additional_email'].replace("|",",") : "";
0
0
1
+ 769 other calls in file
210 211 212 213 214 215 216 217 218 219
let token1 = encrypt(userData.data._id + parseInt(text)); let expiry = new Date(); expiry.setMinutes(expiry.getMinutes() + 30); password_resets.save({email: req.body.email, reset_token: token1, expiry: expiry}).then((pwdResetData) => { if (pwdResetData["status"] == 1) { let tpl_swig = swig.compileFile('public/mail_page/index.html'); let link = '<a href="' + env.adminUrl + 'reset-password/' + token1 + '">' + env.adminUrl + 'reset-password/' + token1 + '</a>'; let content = templateData.content; let subject = templateData.subject; content = content.replace('@email@', userData.data.email);
0
0
1
swig.compileFile is the most popular function in swig (1638 examples)