Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 yeoman创建的应用程序由grunt和根路径提供服务_Gruntjs_Yeoman - Fatal编程技术网

Gruntjs yeoman创建的应用程序由grunt和根路径提供服务

Gruntjs yeoman创建的应用程序由grunt和根路径提供服务,gruntjs,yeoman,Gruntjs,Yeoman,当您从自己创建的应用程序运行grunt-service时,节点web服务器将启动并按预期显示应用程序 当您从服务器查看生成的源代码时,它引用 bower_components/bootstrap/js/######,scripts/main.js等等,但是在index.html和scripts/main.js所在的“app”文件夹中,没有bower_组件 我注意到,当您运行grunt时,dist文件夹中生成的应用程序确实包含bower_组件和所有必需的文件,因此它可以从任何web服务器运行 所以

当您从自己创建的应用程序运行
grunt-service
时,节点web服务器将启动并按预期显示应用程序

当您从服务器查看生成的源代码时,它引用
bower_components/bootstrap/js/######
scripts/main.js
等等,但是在index.html和scripts/main.js所在的“app”文件夹中,没有bower_组件

我注意到,当您运行
grunt
时,dist文件夹中生成的应用程序确实包含bower_组件和所有必需的文件,因此它可以从任何web服务器运行


所以问题是,当您运行
grunt-service
时,grunt如何映射所有文件和文件夹?这是在哪里配置的?

Gruntfile.js
中有一个名为
connect
的部分,它管理各种服务器配置,包括livereload、test和dist。每个连接都有一个中间件部分,其中bower\u组件映射到文档根目录中


利弗雷罗德:{
选项:{
开放:是的,
中间件:功能(连接){
返回[
connect.static('.tmp'),
连接()。使用(
“/bower_组件”,
连接.静态(“./bower_组件”)
),
connect.static(appConfig.app) ];
}
}
},