Skip to content
jstrimpel edited this page Nov 6, 2014 · 6 revisions

Lazo classifies links as imports and "others". Others being all other link types with most common being [rel="stylesheet"].

Links and Routes

There are two supported levels of links in Lazo with the first level being application. Application links are defined in app.json using the css and imports array properties. The array elements can be strings, which are paths to the location of the link file or they can be objects that contain properties, which will be attributes of the link nodes. By default these link nodes are added to the top of the document and are applied to every route.

The second level of links are component links. When the application is started Lazo scans the component directories for files with an extension of .css. It also looks for files with an extension of .html in imports directories in the component directories. These results make up a component’s other and import links. When a route action is executed the component links for the route are automatically added to the document after the application link nodes and the previous route component links are removed from the document.

Link Ordering

By default links sorted by file name and grouped as follows.

  • Import Links
    • Application
    • Component
  • Other Links
    • Application
    • Component

Link order can be modified by overriding the lazoBundle methods sortCss and sortImports by extending lazoBundle.

Attributes

Lazo sets default attribute values on link nodes, but it also provide APIs for modifying link attribute values.

Component Level Link Augmenting

Component links can be augmented using the <controller>.augmentCssLink and <controller>.augmentImportLink methods. Every other link pass through augmentCssLink and every import link passes through augmentImportLink.

Route Level Link Augmenting

Both application and component links can be modified by overriding the lazoBundle methods sortCss and sortImports by extending lazoBundle. These methods are passed an array of link objects. These arrays contain all application and component links for a route and are used to append the link nodes to the document for a route. These two APIs

Combo Handling

The expected response from a custom <lazoBundle>.response method is:

{
    javascript: []
    css: [],
    imports: []
}

For more information on combo handling please see the documentation.