Compiling resources for my plone site: how?

I'm about to deploy a web site, and I need to bundle JS files into one. I though Plone was going to do it automagically, but it doesn't; I guess it used too..., because some older instance have a default.js file that bundles many files.

So now I have a bunch of JS hits each time there's a request:

jquery.min.js
require.js
mosaic-grid.js
mosaic-styles.js
plone-base-compiled.min.js
plone-moment-compiled.min.js
plone-compiled.min.js
++resource++plone.session.refreshsupport.js?version=2021-01-19%2001%3A03%3A43.350567
dropdownmenu-compiled.js
plone-legacy-compiled.js
config.js

How to bundle them into one default.js file?

I tried to use the plone-compile-resources script, but I get this error with Mosaic resources:

Running "less:mosaic" (less) task
>> NameError: variable @bootstrapPath is undefined in /vagrant/plone/src/plone.app.mosaic/src/plone/app/mosaic/browser/static/css/mosaic.grid.less on line 2, column 21:
>> 1 @import (reference) "@{barcelonetaPath}/less/variables.plone.less";
>> 2 @import (reference) "@{bootstrapPath}/less/bootstrap.less";
>> 3
Warning: Error compiling /vagrant/plone/src/plone.app.mosaic/src/plone/app/mosaic/browser/static/css/mosaic.pattern.less Use --force to continue.

At this point I have no idea what to do next; I'm not a Javascript/CSS guru.

Thanks in advance for any help.

Edit: I used :

./bin/plone-compile-resources -b plone

In order to not include Mosaic in the bundle , but it did not combined most resources into one, I still have a lot of distinct js files.

2 Likes