【问题标题】:how do you add attributes to script tag in jade e.g. async defer你如何在jade中为脚本标签添加属性,例如异步延迟
【发布时间】:2015-10-26 03:02:13
【问题描述】:

我需要根据文档添加 async 和 defer 属性以添加 google plus 一个按钮。我如何在玉中做到这一点?

<script src="https://apis.google.com/js/platform.js" async defer></script>

【问题讨论】:

  • 我正在删除我的答案,因为我认为您已经尝试过脚本(src='apis.google.com/js/platform.js', async, defer),但我继续使用jade-lang.com/demo试过了,网上的编译器看到ok,function template(locals) { var buf = [];变种jade_mixins = {};变种玉interp; buf.push(' Hello

    Hello world!

    ');返回 buf.join(""); } 并且看起来还可以

标签: javascript html pug


【解决方案1】:

这对我有用:

script(async, defer, src='https://apis.google.com/js/platform.js')

【讨论】:

  • 我目前有这个工作:脚本(async defer src="maps.goog...")
  • 当我包含脚本(异步 ...)或脚本(异步,...)时出现“TypeError:code.replace 不是函数”。注意一个有逗号,一个没有。必须把它写成脚本(async="true")
猜你喜欢
  • 1970-01-01
  • 2012-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-17
相关资源
最近更新 更多