zoukankan      html  css  js  c++  java
  • 模板引擎之jade 学习

    jade 模板引擎在node express 开发中有较多的使用,首先我们看一个简单的使用jade 生成的html 页面的标签代码:

    doctype html
    html(lang="en")
      head
        title= pageTitle
        script(type='text/javascript').
          if (foo) {
             bar(1 + 5)
          }
      body
        h1 Jade - node template engine
        #container.col
          if youAreUsingJade
            p You are amazing
          else
            p Get on it!
          p.
            Jade is a terse and simple
            templating language with a
            strong focus on performance
            and powerful features.


    相应生成的html 代码如下:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>Jade</title>
        <script type="text/javascript">
          if (foo) {
            bar(1 + 5)
          }
        </script>
      </head>
      <body>
        <h1>Jade - node template engine</h1>
        <div id="container" class="col">
          <p>You are amazing</p>
          <p>Jade is a terse and simple
             templating language with a
             strong focus on performance
             and powerful features.</p>
        </div>
      </body>
    </html>

    我们可以看到使用jade 模板可以简化我们的代码.

  • 相关阅读:
    c#线程带参数
    svn自动update到指定目录
    204. 计数质数
    178. 分数排名
    387. 字符串中的第一个唯一字符
    374. 猜数字大小
    371. 两整数之和
    350. 两个数组的交集 II
    326. 3的幂
    219. 存在重复元素 II
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/3526942.html
Copyright © 2011-2022 走看看