Jan*_*_dh 0 javascript google-maps-api-3 gruntjs yeoman bower
我正在使用Yeoman webapp生成器(https://github.com/yeoman/generator-webapp),我已经添加了Bower包GMAPS(https://github.com/hpneo/gmaps).将Gmaps添加到我的项目后,我在项目的顶部添加了Google Api链接
<!-- build:css(.tmp) styles/main.css -->
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
Run Code Online (Sandbox Code Playgroud)
问题是,当我使用Grunt Serve
命令时,我看到我的Gmaps出现在我的本地主机上运行的网站上.如果我Grunt
构建我的项目它总是给我一个错误,在我的main.js
文件中它找不到变量Gmaps(用于触发Gmaps插件).
所以我的问题是:如何将API添加到使用Grunt构建的项目中?
小智 5
您需要在index.html中复制google api link outsite generator标签.例如:
<script src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
<!-- build:js(.) scripts/vendor.js -->
</script>
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
</script>
<!-- endbower -->
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3785 次 |
最近记录: |