Home > Software design >  How to solve handlebar partials are not supported in VS Code?
How to solve handlebar partials are not supported in VS Code?

Time:11-20

I am using handlebars as templeting engine for my project. I am using prettier for formatting but during formatting hbs file i am getting error as SyntaxError: Handlebars partials are not supported . I tried to find solution on internet but failed.

Here is complete log of error:

SyntaxError: Handlebars partials are not supported:

(error occurred in 'an unknown module' @ line 2 : column 2) (2:2)

1 |

2 | {{> header}}

|  ^^^^^^^^^^^^

3 |

4 |

5 |

at n (c:\Users\Admin.vscode\extensions\esbenp.prettier-vscode

9.0.0\node_modules\prettier\parser-glimmer.js:1:1320)

at Object.parse (c:\Users\Admin.vscode\extensions\esbenp.prettier-vscode

9.0.0\node_modules\prettier\parser-glimmer.js:1:183895)

at Object.parse$a [as parse] (c:\Users\Admin.vscode\extensions\esbenp.prettier-vscode

9.0.0\node_modules\prettier\index.js:12513:19)

My code is:

{{> header}}
     <header>
       <nav >
         <a href="#" style="display: inline-block">
           <object
             data="./images/background.png"
             width="100"
             height="80"
             style="pointer-events: none"
           ></object>
         </a>
         <div >
           <input
             type="text"
             name="search-bar"
             id="search"
             placeholder="Search..."
             maxlength="15"
           />
           <a href=""
             ><i data-feather="search" ></i
           ></a>
         </div>
         <div >
           <a href=""><i data-feather="bell"></i></a>
           <a href=""><i data-feather="user"></i></a>
           <a href=""><i data-feather="settings"></i></a>
         </div>
       </nav>
     </header>
     <br></br>
      <h1  align = "center">WHAT TO DO AFTER 12TH?</h1>
      <hr  color = "black">
       <section >
       <ul >
         <li >TIP 1</li>
         <li >TIP 2</li>
         <li >TIP 3</li>
         <li >TIP 4</li>
         <li >TIP 5</li>
          <li >TIP 6</li>
           <li >TIP 7</li>
       </ul>
     </section>
    {{> footer}}

CodePudding user response:

You can use a .prettierignore file to ignore templates.

# if your files are in a templates folder for example
# add this folder to the .prettierignore
templates
  • Related