我们在应用中使用了fork of benib/aurelia-leaflet。
jspm install github:shaunluttin/aurelia-leaflet
插件includes the original in its installation as a dependency并导致以下安装。
jspm_packages
github
Leaflet <----- the original
Leaflet@0.7.7
dist
images
leaftlet.css
leaflet.js
leaflet-src.js <----- dependency
Leaflet@0.7.7.js
shaunluttin
aurelia-leftlet@0.1.2 <----- the aurelia plugin
helpers
aurelia-leaflet-exceptions.js
index.js <----- dependency
leaflet.html
leaflet.js
leaflet-defaults.js
aurelia-leaflet@0.1.2.js
这些是指向依赖项的模块定义。
Leaflet@0.7.7.js
define(["github:Leaflet/Leaflet@0.7.7/dist/leaflet-src"], function(main) {
return main;
});
aurelia-leaflet@0.1.2.js
define(["github:shaunluttin/aurelia-leaflet@0.1.2/index"], function(main) {
return main;
});
为了提高性能,我们将这样的aurelia-leaflet捆绑在一起:
"dist/leaflet-bundle":
"includes": [
"shaunluttin/aurelia-leaflet",
"shaunluttin/aurelia-leaflet/*.js",
"shaunluttin/aurelia-leaflet/leaflet.html!text"
],
gulp bundle
使用aurelia-bundler创建以下包。
"leaflet-bundle.js" : [
"github:Leaflet/Leaflet@0.7.7.js",
"github:Leaflet/Leaflet@0.7.7/dist/leaflet-src.js",
"github:shaunluttin/aurelia-leaflet@0.1.2.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/aurelia-leaflet-exceptions.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/helpers/layer-factory.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/index.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/leaflet-defaults.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/leaflet.html!github:systemjs/plugin-text@0.0.3.js",
"github:shaunluttin/aurelia-leaflet@0.1.2/leaflet.js"
]
捆绑包括原始leaftlet,因为aurelia-leaflet在其index.js文件中指定依赖项。
有没有办法在不必指定每种文件类型的情况下捆绑aurelia-leaflet?这看起来很冗长:
"dist/leaflet-bundle":
"includes": [
"shaunluttin/aurelia-leaflet",
"shaunluttin/aurelia-leaflet/*.js",
"shaunluttin/aurelia-leaflet/leaflet.html!text"
],