We are javascript beginners. I tried to put gulp on my own, so there are a lot of tricky parts, but I'd be happy if you could support it.

When you try to compile by writing the description of include in the first line of ejs below, an error such as garbled characters is shown in the terminal.

Error message


    Error: Could not find the include file "(&# 39;tamplete/_header&# 39;, {path:&# 39;./&# 39;})"
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false
Applicable source code
<%-include ('template/_header', {path: './'})%>
<%-include template/_footer%>
Source code to be included
    <li><a href = "<% = path;%>">HOME</a></li>
    <li><a href = "<% = path;%>">CONTACT</a></li>
Settings file
gulp.task ('ejs', () =>{
return gulp.src (['./ src/view/page/**/*. ejs','./src/view/page/*. ejs', '!' + './src/view/page/**/_ *. ejs']))
.pipe (ejs ({}, {}, ejsSettingOptions))
.pipe (gulp.dest ('./ public'))

If i don't specify the second argument, you can compile normally.
So I think there is no problem with the configuration file.

I want to change the path of the a tag according to the hierarchy of the file to include, as i am finally using ejs.

Thank you very much.

Supplemental information (FW/tool version etc.)

gulp: 4.0.0
gulp-ejs: 5.10.0

Verification pc: osx sierra 10.12.6
Browser: chrome

  • Answer # 1

    Maybe, but
    include ('template/_header', {path:'./'})

    I thought that there was a space after the include.