How to use the loaders function from swig

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

999
1000
1001
1002
1003
1004
1005
1006
1007
1008
this.context = context;

this.engine = new swig.Swig({
  cache: this.cache || 'memory',
  locals: this.context.locals,
  loader: this.loader || swig.loaders.memory(context.templates, '/')
});

Object.keys(filters).forEach(function(name) {
  self.engine.setFilter(name, filters[name](self));
fork icon0
star icon1
watch icon0

+ 5 other calls in file

37
38
39
40
41
42
43
44
45
46
47
const auth = jwt({
  secret: config.secret,
  userProperty: "payload",
});
swig.setDefaults({
  loader: swig.loaders.fs(path.join(__dirname, "../config/templates")),
});


// SMTP settings
// let transporter = nodemailer.createTransport({
fork icon0
star icon0
watch icon1

+ 70 other calls in file

33
34
35
36
37
38
39
40
41
42
43
  secret: config.secret,
  userProperty: 'payload'
});
swig.setDefaults(
  {
    loader: swig.loaders.fs(path.join(__dirname, '../config/templates'))
  }
);


// SMTP settings
fork icon0
star icon0
watch icon1

+ 69 other calls in file

16
17
18
19
20
21
22
23
24
25
26
var browserSync = require('browser-sync');


var opts = {
    defaults: {
        autoescape: true,
        loader: swig.loaders.fs(process.cwd()),
        cache: false,
        varControls: config.swig.varControls || [ "{{", "}}" ],
        locals: {
            now: function () {
fork icon0
star icon0
watch icon0

83
84
85
86
87
88
89
90
91
92
                  },
                  cache: 'memory',
*/
                  cache: this._cache,
                  locals: Object.assign({}, LOCALS, this._locals),
                  loader: swig.loaders.fs(this._root, {
                          encoding: this._ecoding
                  }),
                  offset: this._timeZoneOffset
          });
fork icon0
star icon0
watch icon2