如何使用Slim在HTML标记中添加具有ID的JavaScript代码?

时间:2018-10-22 08:12:48

标签: javascript html slim-lang

在以下Slim代码段中,我们如何将id / type属性添加到head标签中的javascript标签(类似于html中的script标签)。

Slim docs除了简单的警报语句外,没有显示如何执行此操作。

P.S。代码简明扼要

doctype html
html
  head
    title
      | Example
    <!-- How to add script id and type in the following code? -->
    javascript:
      alert('Slim supports embedded javascript!')
  body
    #root

2 个答案:

答案 0 :(得分:0)

根据您发布的docs link,您可以简单地内嵌脚本标签:

apple

答案 1 :(得分:0)

经过研究并从各处获取信息后,我找到了上述答案的替代方法。

doctype html
html
  head
   title
     | Example
   script#ID_HERE type="text/javascript"
     | JS CODE
  body
    #root