First, you will need to run the customization generator
kiso_themes:customize. This will generate an
kiso_themes.jsfile, which contains the imports for all external libraries. You can now edit that file to remove anything you don't need, but be sure to not remove Bootstrap itself - unless you really mean to.
Next, take a look at the view partial in
views/layouts/_external_js_libs.html.erb. This contains code which handles the loading of particularly heavy JS libraries:
You can remove whichever libraries you don't intend to use.
Finally, in the
views/layouts/_baselayout there are special tags on the
bodyelement under the
data-js-libsdata attribute. Remove any of the default libraries from this attribute that you don't need. Search your project for the string
content_for :js_libsand review any additional JS libs that are loaded on a per-view basis that you might not want (dashboard demo libraries for example).
This allows you to specify exactly those libraries which should be rendered out before everything else, or are otherwise not part of your asset pipeline manifest in
#Activating libraries in
external_js_libs for inclusion in the rendered output
Let's say you have a specific page that you want to load Google Maps on, and only that page. To have the appropriate external JS libs be rendered to the output, you'd need to include the following on that specific page:
<% content_for :js_libs, "gmaps" %>
This will cause the Google Maps include tag to be rendered in
#Adding additional libraries to _external_js_libs.html.erb
All you have to do is place the
@js_libsinstance variable for inclusion of a library name you specified in your
That block of code would be rendered when a
content_for :js_libs, 'chartjs'tag is encountered on a page.
In this case I've also chosen to have the
includetags rendered into the
#Removing the Demo JS code
Once you run the customization generator as above, you can simply remove all
requirestatements that reference