* Returns the nunjucks environment for the current module. * The environment is checked in the _nunjucksEnvironment instance variable. * @returns {object} The Nunjucks Environment
()
| 160 | * @returns {object} The Nunjucks Environment |
| 161 | */ |
| 162 | nunjucksEnvironment () { |
| 163 | if (this._nunjucksEnvironment !== null) { |
| 164 | return this._nunjucksEnvironment; |
| 165 | } |
| 166 | |
| 167 | this._nunjucksEnvironment = new nunjucks.Environment(new nunjucks.WebLoader(this.file(""), { async: true }), { |
| 168 | trimBlocks: true, |
| 169 | lstripBlocks: true |
| 170 | }); |
| 171 | |
| 172 | this._nunjucksEnvironment.addFilter("translate", (str, variables) => { |
| 173 | return nunjucks.runtime.markSafe(this.translate(str, variables)); |
| 174 | }); |
| 175 | |
| 176 | return this._nunjucksEnvironment; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Called when a socket notification arrives. |
no test coverage detected