Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.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
Javascript 我是否可以让父Gruntfile.js在子Gruntfile.js上交互或运行任务?_Javascript_Gruntjs - Fatal编程技术网

Javascript 我是否可以让父Gruntfile.js在子Gruntfile.js上交互或运行任务?

Javascript 我是否可以让父Gruntfile.js在子Gruntfile.js上交互或运行任务?,javascript,gruntjs,Javascript,Gruntjs,我正在构建一个框架,允许在父应用程序生态系统中创建模块化的“应用程序” 父应用程序的根目录中将有一个Gruntfile.js,然后在文件夹结构的更深处将有子“应用程序”,我希望允许它们拥有自己的Gruntfile 见下文: /application |-- Gruntfile.js |-- /apps |---- /modularApp1 |------ Gruntfile.js |---- /modularApp2 |------ Gruntfile.js 有人知道在Grunt 0.4中处理

我正在构建一个框架,允许在父应用程序生态系统中创建模块化的“应用程序”

父应用程序的根目录中将有一个Gruntfile.js,然后在文件夹结构的更深处将有子“应用程序”,我希望允许它们拥有自己的Gruntfile

见下文:

/application
|-- Gruntfile.js
|-- /apps
|---- /modularApp1
|------ Gruntfile.js
|---- /modularApp2
|------ Gruntfile.js

有人知道在Grunt 0.4中处理这个问题的方法吗?我需要创建自己的Grunt任务来处理这个问题吗?

我正在处理一个设置非常类似的项目。我使用该任务在我的“子应用程序”上运行任务,而且大部分情况下效果都很好。我对建议的运行监视任务的方法有一些小问题,所以我只是简单地使用grunt hub在子应用程序上执行监视任务

下面是我的集线器配置的一个基本示例:

hub: {
  src: [
    'protected/modules/*/Gruntfile.js'
  ],
  default: {
    src: '<%= hub.src %>',
    tasks: [
      'default'
    ]
  },
  build: {
    src: '<%= hub.src %>',
    tasks: [
      'build'
    ]
  },
  watch: {
    src: '<%= hub.src %>',
    tasks: [
      'watch'
    ]
  }
}
hub:{
src:[
'protected/modules/*/grunfile.js'
],
默认值:{
src:“”,
任务:[
“默认”
]
},
建造:{
src:“”,
任务:[
“建造”
]
},
观察:{
src:“”,
任务:[
“注意”
]
}
}

有没有办法让这些单一任务(构建、监视)自动处理?我的意思是:grunt hub:test->自动搜索子gruntfiles中的所有测试目标