ThemeAPI module
The ThemeApi provides functionally, dependencies, configuration and routes that assist with theming.
The most notable functionality provided is the /styleguide/** routes that renders key components, palettes and styles so they can be reviewed and provide usage examples.
Adding blade components to regions
Your module might need to inject a blade template in the layout. Eg script tags for GTM, Intercom, etc. If so, your module just needs to register this addition in its service provider register() method.
Example of registering browsersync on dash & frontend just before the closing body tag.
public function register()
{
parent::register();
LayoutService::registerRegionComponent(
LayoutSections::ALL, // section to register (all, dash, frontend)
LayoutRegions::POST_BODY, // where in the layout (head_scripts, post_body, etc)
['themeapi::browsersync'] // What components get added.
);
}
TODO
This module should be responsible for qirolab/laravel-themer configuration, middleware and anything else to do with theme switching. With a minor amount of refactoring this did not go smoothly and needs more time. Once this gets sorted this text should be removed and replaced with information on how to switch themes.