[英]Reference files from bower_components
My index.html
file is not loading the Angular files in the bower_components
folder or my app.js
folder when I run http-server
. 运行http-server
时,我的index.html
文件未将bower_components
文件夹或app.js
文件夹中的Angular文件加载。 This is for a simple tutorial I am doing. 这是我正在做的简单教程。 So I know the structure is not ideal 所以我知道结构不理想
Angular-Weather 角度天气
-- app
--home.html
--index.html
--own-app.js
-- bower_components
--angular
--angular.js
--angular-route
--angular-route.js
-- bower.json
-- README.md
index.html index.html
<!doctype html>
<html lang="en" ng-app="OWMApp">
<head>
<meta charset="UTF-8">
<title>Open Weather Map App</title>
</head>
<body>
<div ng-view></div>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-route/angular-route.js"></script>
<script type="text/javascript" src="owm-app.js"></script>
</body>
</html>
It is because the bower_components
folder is not inside the app
folder, so the http-server cannot serve it because it does not exist. 这是因为bower_components
文件夹不在app
文件夹内,所以http服务器无法提供它,因为它不存在。
I guess the folder was created automatically for you by bower. 我猜这个文件夹是Bower为您自动创建的。 You can tell bower to create it inside the app
folder, for that create a .bowerrc
file in the root directory with: 您可以告诉bower在app
文件夹中创建它,为此在根目录中创建一个.bowerrc
文件,其中包括:
{
"directory": "app/bower_components"
}
The next bower install
will install it the correct place. 下次bower install
将其安装到正确的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.