<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 11. 如何使用 pug (jade) 作為 HTML 的模板 首先肯定會問什么是 [pug](https://github.com/pugjs/pug),如果是 nodejs 程序員的話,肯定聽過 `jade` 吧,`pug` 就是 從 `jade` 改名過來的。 說白了,它就是可以讓你以更好的語法來寫 html 。 下面看看例子就會清楚的。 現在我們就要代替之前的 `src/index.html` 改用 pug 語法來寫。 首先把 `src/index.html` 改名叫 `src/index.pug` ``` $ rename src/index.html src/index.pug ``` **src/index.pug** ``` doctype html html(lang="en") head title= pageTitle script(type='text/javascript'). if (foo) bar(1 + 5) body h1 Pug - node template engine #root #container.col if youAreUsingPug p You are amazing else p Get on it! p. Pug is a terse and simple templating language with a strong focus on performance and powerful features. ``` 上面的內容是從 `pug` 官方的示例中抄的,然后稍微改了一下。 **webpack.config.js** ``` ... module.exports = { ... plugins: [ ... new HtmlWebpackPlugin({ template: './src/index.pug', ... }), ... ], module: { rules: [ ... { test: /\.pug$/, loader: ['raw-loader', 'pug-html-loader'] } ] } }; ``` ``` $ npm install --save-dev pug pug-html-loader raw-loader ``` 這樣基本沒啥問題,來看下結果: ![](https://box.kancloud.cn/0e55b27f89ab9bc6f21d03bd04fa594f_961x324.png) 我們來試試 `pug` 的 `include` 功能,就是可以包含子模板。 **src/index.pug** ``` ... body include includes/header.pug ... ``` **src/includes/header.png** ``` h1 from header pug file ``` 目錄結構是這樣的: ``` src ├── Root.js ├── app.js ├── app.scss ├── contact.html ├── contact.js ├── includes │ └── header.pug └── index.pug ``` 結果: ![](https://box.kancloud.cn/a6133bf0697019fdfba3fbae28203701_1089x364.png) 先這樣吧。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看