如何在基础玉文件块中追加内容

时间:2016-10-17 10:36:44

标签: pug

您好,我在运行以下代码时遇到了问题。

layout.jade

include ../includes/config.jade
//- Read config variables from page extension
block config
doctype html
 html(lang="en")
 head
  //- Styles
  include ../includes/styles.jade
  //- Scripts Common and custom scripts
  include ../includes/scripts.jade
 body
  //Header common for all pages
  include ../modules/header.jade
  //Page Specific Contents
  block content
  //Footer common for all pages
  include ../modules/footer.jade

Script.jade

  //- Scripts 
  script(type="text/javascript" src="js/jquery-3.1.1.min.js")
  //- script(type="text/javascript" src="js/material.min.js")
  script(type="text/javascript" src="js/master.js")

  //Code should append in following block....
  block customScript

  script(type="text/javascript").
  $( document ).ready(function() {
    if(NCF)
    {
       NCF.initialSetUp();
       console.log(NCF.test);
    }
  });

tintUpHolder.jade

append customScript
 script(async type="text/javascript" src="https://d36hc0p18k1aoc.cloudfront.net/pages/a5b5e5.js")

 div.tintUpHolder
  div(data-id="louise-marcussen" data-columns="3" data-expand="true" data-infinitescroll="true" data-personalization-id="828697" style="height:500px;width:85%;").a5b5e4

页面文件 例如   ageGate.jade

extends jade/layout/master

block config
 - title = title + ' - AgeGate'

block customScript
 script.
  NCF.page = "ageGate";

block content
 include jade/modules/ageGate.jade 
 include jade/modules/tintUpHolder.jade

文件夹结构

  • enter image description here

  • 我的愿望是

我希望来自tintUpHolder.jade文件的内容应该附加到脚本文件块“customScript”。

0 个答案:

没有答案