【问题标题】:Can you use haml in an html file?你可以在 html 文件中使用 haml 吗?
【发布时间】:2017-10-22 20:56:19
【问题描述】:

haml 代码是否包含在 html 文件的正文标记中?

.flex
.intro.animate#microsoft-container
    .logo
        - (1..4).each do
            .box
    .brand
        Microsoft

%iframe.player{:width => 0, :height => 0, :src => 
"https://www.youtube.com/embed/I3Ak5VgyEoc?autoplay=1" }

【问题讨论】:

    标签: html sass haml


    【解决方案1】:

    不。 HAML 是 HTML 的抽象。因此需要先转换为 HTML,然后才能放入 HTML 文档中。

    这是您的 HAML 转换后的 https://codepen.io/sitrobotsit/pen/MmZBWx

    <div class='flex'></div>
    <div class='intro animate' id='microsoft-container'>
      <div class='logo'>
        <div class='box'></div>
        <div class='box'></div>
        <div class='box'></div>
        <div class='box'></div>
      </div>
      <div class='brand'>
        Microsoft
      </div>
    </div>
    <iframe class='player' height='0' src='https://www.youtube.com/embed/I3Ak5VgyEoc?autoplay=1' width='0'></iframe>
    

    如果您经常使用 HAML,则需要在本地进行 HAML 转换,请参阅 -> http://haml.info/tutorial.html

    【讨论】:

      猜你喜欢
      • 2011-10-03
      • 2021-11-03
      • 1970-01-01
      • 1970-01-01
      • 2022-01-08
      • 2010-11-10
      • 2020-01-29
      • 2016-12-01
      相关资源
      最近更新 更多