Which files are included in the generated widgets.css and widgets.js ?

3
How is the widgets.css and widgets.js generated? When building widgets, I was always including the following line to add the widget's css. mxui.dom.addCss(require.toUrl("WidgetName/widget/ui/WidgetName.css")); This is described in the Mx 4 tutorials, however I don’t see it in the Boilerplate Code, and when you are running the CSS file is nicely included in the widget.css (but additional css files are not) How should this be done correctly? The something else is going one with widget.js . All js files are placed in there... but which one? In some widgets there are multiple files they are loaded with 'require' additionally. This caused some issue with cashing. The Browser caches should be cleared after a widget update. This is acceptable for developers but for normal users, this is not intuitive. Is there a solution for this? Note: When running in debug mode http://localhost:8080/index-console.html the widget.js is disappears at all. Now all widget files are loading separately, Like: WidgetName.js?12356465897 ... .though handy for debugging.
asked
1 answers
1

The proper way to add extra external CSS files other then the default is to still use this:

mxui.dom.addCss(require.toUrl("WidgetName/widget/ui/WidgetName.css"));

The file 'WidgetName/widget/ui/WidgetName.cssi' , where WidgetName is replaced with the actual name of the widget, is automaticly combined in the widgets.css file that is created when deploying a Mendix application.

You should only use this if you really need extra external files. Another approach, since all is combined anyway, is to copy paste the CSS from the other files in to ''WidgetName/widget/ui/WidgetName.cssi'' ... Then you will get the same result in the end.

answered