Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gruntjs Grunt汇编:多个发行版_Gruntjs_Assemble - Fatal编程技术网

Gruntjs Grunt汇编:多个发行版

Gruntjs Grunt汇编:多个发行版,gruntjs,assemble,Gruntjs,Assemble,我们正在进行一个组装项目,该项目将需要一些共享布局和一些自定义布局 最初,默认页面只有一个目的地。现在,我们要打破这种局面,让每个品牌/网站都有自己的分发文件夹 我的问题是——在我们解决问题之前,所有的东西都组装好了。现在我们有了多个发行版,事情变得有点混乱:) 当前设置: 模板 |-- templates | |-- _default | | |--includes | | |--layouts | | |--pages | |-- brand 1

我们正在进行一个组装项目,该项目将需要一些共享布局和一些自定义布局

最初,默认页面只有一个目的地。现在,我们要打破这种局面,让每个品牌/网站都有自己的分发文件夹

我的问题是——在我们解决问题之前,所有的东西都组装好了。现在我们有了多个发行版,事情变得有点混乱:)

当前设置:

模板

  |-- templates
  |  |-- _default
  |  |  |--includes
  |  |  |--layouts
  |  |  |--pages
  |  |-- brand 1
  |  |  |--includes
  |  |  |--layouts
  |  |  |--pages
  |  |-- brand 2
  |  |  |--includes
  |  |  |--layouts
  |  |  |--pages
我们的任务是:

    assemble: {
        options: {
        flatten: true,
        production: false,
        postprocess: require('pretty'),

    // Metadata
    pkg: '<%= pkg %>',
    site: '<%= site %>',

    // Templates
    // partials: '<%= site.includes %>',
    // layoutdir: '<%= site.layouts %>',
    // layout: '<%= site.layout %>'
  },
    brand1: {
      files: {'<%= site.justin %>/': ['<%= site.templates %>/justin/**/*.hbs']}
    },
    brand2: {
      files: {'<%= site.jow %>/': ['<%= site.templates %>/jow/**/*.hbs']}
    },
    tonylama: {
      files: {'<%= site.tonylama %>/': ['<%= site.templates %>/tonylama/**/*.hbs']}
    },
    brand3: {
      files: {'<%= site.nocona %>/': ['<%= site.templates %>/nocona/**/*.hbs']}
    },
    brand4: {
      files: {'<%= site.chippewa %>/': ['<%= site.templates %>/chippewa/**/*.hbs']}
    }
}
汇编:{
选项:{
扁平化:是的,
制作:假,,
后处理:需要('pretty'),
//元数据
包装:'',
网站:“”,
//模板
//分部:'',
//layoutdir:“”,
//布局:“”
},
品牌1:{
文件:{'/':['/justin/***.hbs']}
},
品牌2:{
文件:{'/':['/jow/***.hbs']}
},
扁桃体瘤:{
文件:{'/':['/tonylama/***.hbs']}
},
品牌3:{
文件:{'/':['/nocona/***.hbs']}
},
品牌4:{
文件:{'/':['/chippewa/***.hbs']}
}
}
所以问题变成了——我们如何成功地组装成多个发行版?您能否放置
选项
并指向它们各自的布局和包含内容


当我运行grunt Assembly:brandname时,我得到一个错误
警告:未找到布局文件(忘记密码.hbs)

导致错误的明显原因是布局被注释掉了。除此之外,您应该能够:

assemble: {
  options: {
    flatten: true,
    production: false,
    postprocess: require('pretty'),

    // Metadata
    pkg: '<%= pkg %>',
    site: '<%= site %>',

    // Templates
    partials: '<%= site.includes %>',
    layoutdir: '<%= site.layouts %>',
    layout: '<%= site.layout %>'
  },
  justin: {
    options: {layout: 'justin/layout.hbs'},
    files: {
      '<%= site.justin %>/': ['<%= site.templates %>/justin/**/*.hbs']
    }
  },
  jow: {
    options: {layout: 'jow/layout.hbs'},
    files: {
      '<%= site.jow %>/': ['<%= site.templates %>/jow/**/*.hbs']
    }
  },
  tonylama: {
    options: {layout: 'tonylama/layout.hbs'},
    files: {
      '<%= site.tonylama %>/': ['<%= site.templates %>/tonylama/**/*.hbs']
    }
  },
  nocona: {
    options: {layout: 'nocona/layout.hbs'},
    files: {
      '<%= site.nocona %>/': ['<%= site.templates %>/nocona/**/*.hbs']
    }
  },
  chippewa: {
    options: {layout: 'chippewa/layout.hbs'},
    files: {
      '<%= site.chippewa %>/': ['<%= site.templates %>/chippewa/**/*.hbs']
    }
  }
}
汇编:{
选项:{
扁平化:是的,
制作:假,,
后处理:需要('pretty'),
//元数据
包装:'',
网站:“”,
//模板
分部:'',
layoutdir:“”,
布局:“”
},
贾斯汀:{
选项:{layout:'justin/layout.hbs'},
档案:{
“/”:[”/justin/***.hbs']
}
},
乔:{
选项:{layout:'jow/layout.hbs'},
档案:{
“/”:[”/jow/***.hbs']
}
},
扁桃体瘤:{
选项:{layout:'tonylama/layout.hbs'},
档案:{
“/”:[”/tonylama/***.hbs']
}
},
诺科纳:{
选项:{layout:'nocona/layout.hbs'},
档案:{
“/”:[”/nocona/***.hbs']
}
},
齐佩瓦:{
选项:{layout:'chippewa/layout.hbs'},
档案:{
“/”:[”/chippewa/***.hbs']
}
}
}

这就是说,随着规模的扩大,管理将变得更加困难——正如你所预料的那样。另一个选择是创建一个插件,为每个品牌自动生成一个“目标”()。

使用目标中的选项,我能够修复错误并推送到多个dist文件夹

assemble: {
  options: {
    flatten: true,
    production: false,
    postprocess: require('pretty'),

    // Metadata
    pkg: '<%= pkg %>',
    site: '<%= site %>',
  },
    brand: {
      options: {
        //Template Config
        partials: '<%= site.brandIncl %>',
        layoutdir: '<%= site.brandLayouts %>',
        layout: '<%= site.brandLayout %>'
      },
      files: {'<%= site.brand %>/': ['<%= site.templates %>/brand/pages/*.hbs']}
    }
汇编:{
选项:{
扁平化:是的,
制作:假,,
后处理:需要('pretty'),
//元数据
包装:'',
网站:“”,
},
品牌:{
选项:{
//模板配置
分部:'',
layoutdir:“”,
布局:“”
},
文件:{'/':['/brand/pages/*.hbs']}
}

帮助阅读文档(ugh):P.我注意到选项:{}可以添加到任务或目标。这很有帮助。实际上为其中一个品牌组装了完整的站点!唯一的问题是组装_dist/_justin/cancel-order.html错误警告:找不到部分正文使用--force继续。由于警告而中止。@SalBaldovinos您使用的是
{>body}
在你的布局中?我以为我们更新了正则表达式来检查
{{>body}}
{{body}}
(但是我们可能已经完全删除了
{>body}
语法)。我们现在没有为它使用实际的部分,因此了解你正在使用的汇编版本并查看你的布局可能会有用。是的,我正在使用{{>body}}不知道还有别的办法。不管是哪种办法,现在都起作用了。