Theme
Overview
The Theme module contains helpers for front-end assets, manifest-driven script loading, CSS module classes, templates, sidebars, and small HTML utility types used by themes.
Types in this module
Lipe\Lib\Theme\CSS_ModulesLipe\Lib\Theme\Class_NamesLipe\Lib\Theme\Dashicons(enum)Lipe\Lib\Theme\Register_SidebarLipe\Lib\Theme\ResourcesLipe\Lib\Theme\TemplateLipe\Lib\Theme\Wp_Enqueue_ScriptLipe\Lib\Theme\Wp_Enqueue_Script_ModuleLipe\Lib\Theme\Scripts\CommonLipe\Lib\Theme\Scripts\Config(interface)Lipe\Lib\Theme\Scripts\EnqueueLipe\Lib\Theme\Scripts\External_ManifestLipe\Lib\Theme\Scripts\JS_ManifestLipe\Lib\Theme\Scripts\Manifest(interface)Lipe\Lib\Theme\Scripts\PCSS_ManifestLipe\Lib\Theme\Scripts\ResourceHandles(interface)Lipe\Lib\Theme\Scripts\Svelte_ManifestLipe\Lib\Theme\Scripts\Util
Resources
General-purpose theme resource helper for versions, hashes, body classes, integrity, and CDN-related behavior.
Key public methods
public function get_revision(): ?stringpublic function get_content_hash(string $url): ?stringpublic function get_file_modified_time(string $url): ?intpublic function get_site_root(): stringpublic function live_reload(?string $domain = null, bool $admin_also = false): voidpublic function add_body_class(string|\BackedEnum $css_class): voidpublic function crossorigin_javascript(string $handle, ?string $value = null): voidpublic function integrity_javascript(string $handle, string $integrity): voidpublic function use_cdn_for_resources(array $handles): voidpublic function unpkg_integrity(string $handle, string $url): bool
Example
<?php
use Lipe\Lib\Theme\Resources;
Resources::in()->add_body_class('has-library-assets');
$revision = Resources::in()->get_revision();
CSS_Modules
Loads JSON class maps produced by CSS Modules.
Key public methods
public function set_path(string $path, string $file_prepend = ''): voidpublic function use_combined_file(string $filename): voidpublic function styles(string $file): array
Class_Names
Collects and normalizes CSS class names.
Key public methods
public function __construct(...$classes)public function get_classes(): arraypublic function push(string|\BackedEnum $class_name): voidpublic function __toString()
Template
Theme template helpers.
Key public methods
public function esc_attr(array $attributes): stringpublic function get_template_contents(string $slug, ?string $name = null, $args = []): stringpublic function sanitize_html_class(string $css_class): string
Script arg objects and resource manifests
Wp_Enqueue_Scriptis the args wrapper forwp_enqueue_script()and stores properties such asstrategy,in_footer, andfetchpriority.Wp_Enqueue_Script_Moduleis the corresponding wrapper forwp_enqueue_script_module().Scripts\Commoncentralizes shared theme asset bootstrapping and exposesinit_once(),remove_scripts(),include_styles_in_editor(),support_block_inline_styles(),admin_scripts(),block_scripts(),theme_scripts(),revision_header(),load_css_enums(), andfactory().Scripts\Enqueueand the manifest classes (External_Manifest,JS_Manifest,PCSS_Manifest,Svelte_Manifest) know how to register or enqueue resources and expose methods such asenqueue(),register(),get_file(),get_version(), andget_integrity().Scripts\ManifestandScripts\ResourceHandlesdefine the contracts those loaders depend on.Scripts\Configsuppliespublic function js_config(): arrayfor browser configuration.Scripts\Utiladds helper methods such aspublic function is_webpack_running(ResourceHandles $handle): boolandpublic function is_javascript_resource(ResourceHandles $handle): bool.
Additional theme helpers
Dashiconsenumerates core dashicon values and exposespublic function icon(string|\BackedEnum $class_name = ''): string.Register_Sidebaris the fluent args wrapper forregister_sidebar().