How to use the FileSystemLoader function from nunjucks

Find comprehensive JavaScript nunjucks.FileSystemLoader code examples handpicked from public code repositorys.

165
166
167
168
169
170
171
172
173
174
	pathNormalizer(siteConfiguration.dir.input),
	normalize(path.normalize(".")),
];
console.log("nunjucksFileSystem", nunjucksFileSystem);
let nunjucksEnvironment = Nunjucks.configure(
	new Nunjucks.FileSystemLoader(nunjucksFileSystem),
	{
		throwOnUndefined: throwOnUndefinedSetting,
		autoescape: true,
	}
fork icon3
star icon5
watch icon1

+ 2 other calls in file

8
9
10
11
12
13
14
15
16
17
18
const postcssPresetEnv = require('postcss-preset-env');
const highlight = require('highlight.js');
const prettier = require('prettier');


const nunjucksEnvironment = new nunjucks.Environment(
  new nunjucks.FileSystemLoader(path.resolve(__dirname, 'src', 'docs')),
  {
    throwOnUndefined : true,
  },
)
fork icon3
star icon3
watch icon1

+ 4 other calls in file

13
14
15
16
17
18
19
20
21
22
23
        .join('/')
}


function createEnvironment() {
    const environment = new nunjucks.Environment(
        new nunjucks.FileSystemLoader(
            path.resolve(__dirname, '..'),
            {
                throwOnUndefined: true,
            },
fork icon3
star icon3
watch icon2

+ 3 other calls in file

4
5
6
7
8
9
10
11
12
13
autoescape = opts.autoescape === undefined ? true : opts.autoescape,
noCache = opts.noCache || false,
watch = opts.watch || false,
throwOnUndefined = opts.throwOnUndefined || false,
env = new nunjucks.Environment(
    new nunjucks.FileSystemLoader(path || 'views', {
        noCache: noCache,
        watch: watch,
    }), {
        autoescape: autoescape,
fork icon0
star icon0
watch icon2

+ 3 other calls in file

14
15
16
17
18
19
20
21
22
23

setLibrary(env) {
  this.njkEnv =
    env ||
    new NunjucksLib.Environment(
      new NunjucksLib.FileSystemLoader([
        super.getIncludesDir(),
        TemplatePath.getWorkingDir()
      ])
    );
fork icon0
star icon0
watch icon0

+ 2 other calls in file