ejs icon indicating copy to clipboard operation
ejs copied to clipboard

Add include from absolute path and var

Open Vayel opened this issue 11 years ago • 2 comments

Vayel avatar Mar 12 '14 11:03 Vayel

Where do you need to provide the variables for including from a variable with this commit?

AnthonyMDev avatar May 07 '14 21:05 AnthonyMDev

First of all, sorry for my French English.

Line 159, we split the include's path : paths.dir.to.file becomes ['paths', 'dir', 'to', 'file'] Then, options contains the vars passed to EJS, so we check if options.paths.dir.to.file exists, by looking for options.paths, then options.paths.dir...

So, to include a file from a var, you just need to write : include paths.foo.bar and, on the condition that you passed a var paths.foo.bar to EJS when compiling, it'll include the file having the content of paths.foo.bar as path.

Vayel avatar May 08 '14 06:05 Vayel