我已加入gem gmaps4rails
。我想在地图上显示一些标记(确切地说是3个)和它们的infowindow但是这个宝石带有很多js库并且它减慢了我的网站的负载。
我只想在这一页上使用这些库。我想知道如何删除一些不必要的js库。
<script src="/assets/underscore.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/base.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/base/base.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/objects/base_builder.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/objects/builder.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/objects/handler.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/objects/null_clusterer.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/common.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/bound.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/circle.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/clusterer.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/kml.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/map.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/marker.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/polygon.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/builders/polyline.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/bound.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/circle.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/clusterer.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/kml.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/map.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/marker.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/polygon.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/objects/polyline.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google/primitives.js?body=1" type="text/javascript"></script>
<script src="/assets/gmaps/google.js?body=1" type="text/javascript"></script>
答案 0 :(得分:1)
每个文件都很小,所以列表似乎很大,但代码很少。因此,可能在开发过程中,在第一次渲染它们时会减慢速度,但随后它们会被缓存。
在制作中,它们会在你的应用程序中被压缩。因此存在很难被注意到。
如果您仍然不想在每个页面中使用它们:
在application.js中删除gmaps4rails和下划线的要求
使用以下CDN在页面中包含文件:http://cdnjs.com/libraries/gmaps4rails