繁体   English   中英

bower_components的参考文件

[英]Reference files from bower_components

运行http-server时,我的index.html文件未将bower_components文件夹或app.js文件夹中的Angular文件加载。 这是我正在做的简单教程。 所以我知道结构不理想

角度天气

-- app   
   --home.html
   --index.html
   --own-app.js
-- bower_components
   --angular
     --angular.js
   --angular-route
     --angular-route.js
-- bower.json
-- README.md

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>

这是因为bower_components文件夹不在app文件夹内,所以http服务器无法提供它,因为它不存在。

我猜这个文件夹是Bower为您自动创建的。 您可以告诉bower在app文件夹中创建它,为此在根目录中创建一个.bowerrc文件,其中包括:

{
    "directory": "app/bower_components"
}

下次bower install将其安装到正确的位置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM