Webassets adds two config values to add common js and css files needed by an application so that they can be minified and compacted as the others.

By @mantradev

Install with:

$ mantrad download-component webassets@1.0.0

Or install last version with:

$ mantrad download-component webassets


Webassets component (Mantra version 1.x)

This module adds common js and css files in a middleware for the html templates used in the application. The weight for the middleware is -181.

By doing so, all js and css files (default index.html files and components css and js resources), can be minimized, ofuscated or compacted as components files if this feature is enabled, as it does "resourceminifier" component.

By doing so, those css and js files can be compacted and minified as the others, improving web performance.


Json object with these properties:

    "appname": {
        "cssfiles": <array with css files to include>,
        "jsfiles": <array with js files to include>

For example:

   "landingpage": {
      "cssfiles": ["frontend.assets/css/page.min.css", "frontend.assets/css/style.css"],
      "jsfiles": ["frontend.assets/js/page.min.js", "frontend.assets/js/script.js"]

As explained in Mantra documentation, "frontend" is translated by the location of the frontend of the current application.