Download the PHP package hryvinskyi/magento2-theme-assets without Composer
On this page you can find all versions of the php package hryvinskyi/magento2-theme-assets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download hryvinskyi/magento2-theme-assets
More information about hryvinskyi/magento2-theme-assets
Files in hryvinskyi/magento2-theme-assets
Download hryvinskyi/magento2-theme-assets
More information about hryvinskyi/magento2-theme-assets
Files in hryvinskyi/magento2-theme-assets
Vendor hryvinskyi
Package magento2-theme-assets
Short Description Provides asset rendering functionality for scripts, stylesheets and asset path resolution
License MIT
Package magento2-theme-assets
Short Description Provides asset rendering functionality for scripts, stylesheets and asset path resolution
License MIT
Please rate this library. Is it a good library?
Informations about the package magento2-theme-assets
ThemeAssets Magento 2 / Adobe Commerce
A Magento 2 module that provides asset rendering functionality for scripts, stylesheets, and asset path resolution.
Features
- Asset Rendering: Render JavaScript and CSS assets with multiple loading strategies
- Inline & External: Support for both inline and external asset rendering
- Loading Strategies: Sync, async, and defer loading for scripts
- Preloading: Resource preload hints with fetch priority support
- Content Strategies: Multiple fallback strategies for asset content retrieval
- Caching: Built-in asset caching for improved performance
Installation
Via Composer
Manual Installation
- Create the directory
app/code/Hryvinskyi/ThemeAssets - Copy the module files to the directory
- Run the following commands:
Requirements
- PHP ^8.1
- Magento 2.4.x
- hryvinskyi/magento2-head-tag-manager
Usage
In PHTML Templates
Constants
Render Types
AssetRendererInterface::RENDER_INLINE- Inline the asset contentAssetRendererInterface::RENDER_EXTERNAL- Link to external file
Load Strategies (for scripts)
AssetRendererInterface::LOAD_SYNC- Synchronous loading (blocking)AssetRendererInterface::LOAD_ASYNC- Asynchronous loadingAssetRendererInterface::LOAD_DEFER- Deferred loading
Preload Options
AssetRendererInterface::PRELOAD_ENABLED- Enable resource preloadingAssetRendererInterface::PRELOAD_DISABLED- Disable resource preloading
Fetch Priority
AssetRendererInterface::PRIORITY_HIGH- High fetch priorityAssetRendererInterface::PRIORITY_LOW- Low fetch priorityAssetRendererInterface::PRIORITY_AUTO- Browser default priority
Options Array
The $options parameter supports:
Asset Content Strategies
The module uses a strategy pattern for retrieving asset content with multiple fallbacks:
- MagentoAssetSystemStrategy - Uses Magento's built-in asset system
- DirectStaticFileStrategy - Direct access to static file directory
- FilesystemServiceStrategy - Filesystem service with absolute path
Strategies are tried in order until content is successfully retrieved.
Logging
Asset retrieval failures are logged to var/log/asset_renderer.log.
API Reference
AssetRendererInterface
| Method | Description |
|---|---|
createAsset(string $fileId, array $params = []): File |
Create and cache an asset |
renderScript(...) |
Render a JavaScript asset |
renderStyle(...) |
Render a CSS asset |
getContent(string $fileId, array $params = []): string |
Get raw file content |
AssetPathResolverInterface
| Method | Description |
|---|---|
getViewFilePath(string $fileId, array $params = []): string |
Get asset file path |
getViewFileContent(string $fileId, array $params = []): string\|false |
Get asset file content |
createAsset(string $fileId, array $params = []): File |
Create and cache an asset |
License
MIT License
Author
Volodymyr Hryvinskyi [email protected]
GitHub: https://github.com/hryvinskyi
All versions of magento2-theme-assets with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
magento/framework Version *
hryvinskyi/magento2-head-tag-manager Version *
magento/framework Version *
hryvinskyi/magento2-head-tag-manager Version *
The package hryvinskyi/magento2-theme-assets contains the following files
Loading the files please wait ...