Partial Not Defined in Jade

谁说胖子不能爱 提交于 2019-12-04 10:58:22

问题


Here is what I have in index.jade. And yes I am using express.js

extends layout

block content
  h1 Invoices:
  != partial("invoice")

This matches what I see in every single Jade/Express tutorial. But I get "Reference error: partial not defined". Any ideas why?


回答1:


Jade newest version doesn't support partials. You might be following outdated tutorials. Please read up on jade documentation here




回答2:


Use include, without quotes (This example is from the jade documentation)

users = [{ name: 'Tobi', occupation: 'Ferret' }]

each user in users
  .user
    include invoice

Where invoice is your "partial" template.



来源:https://stackoverflow.com/questions/11267135/partial-not-defined-in-jade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!