The laxar-resources Task

For a given flow target, finds static assets (JSON, CSS, HTML) from the artifacts model and produces a resources listing in JSON format.

The generated listing is used by the LaxarJS runtime to determine which resources are available. For example, the runtime consults the listing to determine if a widget has CSS styles and an HTML template matching the current application theme, or if the default theme should be used instead. If no listing is available, the runtime has to query for the existence of assets by using HTTP HEAD requests, which is annoying during development (slow, many 404 requests in the browser console) and simply unacceptable in production.

For an optimized experience in production, the resource listing embeds the actual resource contents where this makes sense (HTML, JSON), and can in turn be embedded into the application javascript bundle for best minification results. The application template is configured for this by default.

The resources listing is stored under {dest}/{target}/resources.json. Here, dest refers to the configured destination directory (usually var/flows), and target corresponds to the flow target that was specified when running the task.

Overview

Note: This task is an internal building block used by the grunt-laxar main tasks, and not considered a part of the stable API.

Run this task with the grunt laxar-configure laxar-resources:{target} command.

The possible targets are determined by the configuration which is generated by the laxar-configure task. If used without laxar-configure, the task targets, files and options may be specified manually according to the grunt Configuring tasks guide.