【问题标题】:using @include inside inline element in jade/pug template在jade/pug 模板中使用@include 内联元素
【发布时间】:2016-11-12 01:51:02
【问题描述】:

他们是一种在编译时内联并使用jade/pug模板在带有文本的标签内包含外部文档的方法吗?

例如,类似:

p paragraph text content with #[span.icon @include path_to_file/icon.svg] inline svg thrown into the html document

但不是这个解决方案:

p paragraph text content with #[span.icon #[svg #[use(href='path_to_file/icon.svg')]]]

我知道后面的作品,但我正在寻找不使用 use 标签或外部引用的解决方案

解决方案需要在编译时在单词之间的标签内导入文档。

我已经多次查看 pug 文档。只有接近此的事情是标签插值和块扩展,但它们似乎并没有专门考虑这种情况。

谢谢!

【问题讨论】:

    标签: html templates include pug


    【解决方案1】:

    您应该能够使用竖线而不必使用字符串插值:

    p
      | paragraph text content with 
      span.icon 
        include path_to_file/icon.svg
      | inline svg thrown into the html document
    

    在此处查看标签插值:https://pugjs.org/language/interpolation.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-17
      • 2019-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      相关资源
      最近更新 更多