简体   繁体   English

Jade-包含意外的令牌非法

[英]Jade - Unexpected token ILLEGAL on include

I have a strange problem using JADE with server-side rendering. 将JADE与服务器端渲染一起使用时,我遇到一个奇怪的问题。

SyntaxError: C:\Users\{me}\WebstormProjects\evoliance\views\mixins\widget-container.jade:2
   1| include ./widget-container-singleton
 > 2| include ./widget-container-tilelist
   3| include ./widget-container-linelist
   4|
   5| mixin widgetContainer(display, type, data)

I have found that removing the include in the widget-container-tilelist file also remove this error : 我发现删除widget-container-tilelist文件中的include也会删除此错误:

include ./tilelist/links

mixin widgetContainer_tileList(type, data)
    if(type == 'links')
        +widgetContainer_tileListLinks(data)

But what is stranger is the fact that a similar import doesn't cause error : 但是奇怪的是,类似的导入不会引起错误:

include ./singleton/descriptors

mixin widgetContainer_singleton(type, data)
    if(type == 'descriptors')
        +widgetContainer_singletonDescriptors(data)

Here is the targeted include which doesn't seem to be problematic : 这是似乎没有问题的目标包括:

mixin widgetContainer_tileListLinks(data)
    if(data && data.length > 0)
        #component-tilelist-links
            each link in data
                a.tile-link(href=#{link.url}) #{link.title}

Thanks for your help ! 谢谢你的帮助 !

You're trying to interpolate a value in the href attribute of the mixin, causing an error. 您正在尝试在mixin的href属性中插值,从而导致错误。 It should just be assigned to the property link.url . 应该只将其分配给属性link.url

mixin widgetContainer_tileListLinks(data)
    if(data && data.length > 0)
        #component-tilelist-links
            each link in data
                a.tile-link(href=link.url) #{link.title}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM