Bundling details
Application Developer notes
5.6 Bundling details
The Aurelia-KendoUI-bridge is designed to offer you - as end-user - flexibility. The wrappers include only the Kendo files they need for that particular control to work. These files exist (in minified state) in the js
folder of KendoUI distribution.
If you're reading this, then you may be wondering how to bundle these files. There are currently three options for you to consider, so let's explain a few things first.
There are two kinds of scripts in the js
folder : individual and combined scripts. An individual script is a file such as kendo.button.min.js
, containing only one "feature" (button in this case). Combined scripts contain multiple "individual" scripts.
Combined scripts are:
- kendo.ui.core.min.js (only in the CORE version of KendoUI)
- kendo.all.min.js
- kendo.web.min.js
- kendo.dataviz.min.js
- kendo.mobile.min.js
The Aurelia-KendoUI plugin does not use the combined scripts declared above, only the individual files such as kendo.button.min.js
. Thay way, if you only use the button, you would only have to load kendo.button.min.js
instead of the 2MB kendo.all.min.js
.
How bundling works The way bundling works by JSPM, is that it automatically detects any dependencies between your files. A more concrete example is that our plugin imports files in the js
folder of Kendo. The bundler sees this as a dependency and includes these files in the bundle. However, this is not always what you want. There is a way to tell the bundler not to bundle these dependencies automatically, and that is by putting brackets ([ ]
) around the import.
If your app bundle configuration looks like this:
then you can change it to this:
If you bundle now, you will notice that Kendo is not included in your app's bundle, and you can create a seperate bundle just for the Kendo controls.
Now that you know this, you can choose one of the following options.
No bundling at all
This is definitely the easiest option. Instead of bundling the files together, you deploy the entire js
folder. Only the controls you configure in the main.js
file of your application will be loaded, in multiple requests.
To prevent the JSPM bundler from bundling any Kendo files, you can change your includes of your bundle configuration to use brackets, telling JSPM not to bundle dependencies automatically.
Bundling via JSPM
If you want to bundle Kendo, we recommend you to create a seperate bundle. You will want to bundle the minified files in the js
folder.
Bundling Core via JSPM
Note: We have excluded some files from the bundle, because it's unlikely that these files will be used. We also exclude the combined file kendo.ui.core.min.js
, because we are creating our own bundle from all the individual files.
Bundling PRO via JSPM
Kendo PRO is quite difficult to get bundled. For example, the bundler chokes when you try to bundle (and minify) all files, without any exclusions, because it chokes on bundling kendo.spreadsheet.min.js
. It works fine without minification, but without minification you'll end up with a file of ~7MB, which is not acceptable.
A working configuration looks like this:
Note: we exclude a couple of files. Some are combined files, some are unnecessary, and we also exclude the spreadsheet because it gets the bundler stuck.
Mapping to kendo.all.min.js
Note, this is not recommended and has not been tested fully
In your config.js, you can map Kendo files to kendo.all.min.js
. If you do this, then you can just deploy kendo.all.min.js
to your server, instead of bundling all individual files first.
Note: The important part here is "kendo-ui/js/kendo.button.min.js": "kendo-ui/js/kendo.all.min.js",
You will need to map every file in the Kendo js
directory to the kendo.all.min.js
file. We have seen that this is possible, but do not recommend you use this, as it is very verbose. If you know a better way to do this mapping, please contact us and we will update the documentation, so that others can use this information.
Important note
You can find this complete application as a companion document to this book. The application's README file covers bundling issues in even more details, so make sure to check this document.
Last updated