定制 taurus-media/module-hyva-svg-sprite 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

taurus-media/module-hyva-svg-sprite

最新稳定版本:1.0.0

Composer 安装命令:

composer require taurus-media/module-hyva-svg-sprite

包简介

Optimize SVG rendering in Hyva themes by using SVG sprites.

README 文档

README

The Taurus_HyvaSvgSprite module optimizes SVG rendering in Hyva themes by automatically converting individual SVG icons into a single SVG sprite.

Overview

In standard Hyva themes, icons are rendered as individual <svg> elements directly in the HTML. While efficient, this can lead to a larger DOM size if many icons are used or if the same icon is repeated multiple times.

This module intercepts the Hyva\Theme\ViewModel\SvgIcons::renderHtml method. Instead of returning the full SVG content, it:

  1. Adds the icon to a centralized SvgSprite ViewModel.
  2. Returns a light <svg><use href="#icon-id" /></svg> tag.
  3. Renders all collected icons as <symbol> elements within a hidden <svg> sprite at the bottom of the page (before the </body> tag).

Features

  • Performance Optimization: Reduces the overall size of the HTML document by reusing SVG definitions.
  • Automatic Integration: No changes needed to existing templates. It automatically plugins into Hyva's standard icon rendering logic.
  • Zero Configuration: Works out of the box once enabled.

Installation

Via Composer

  1. Install the module:

    composer require taurus-media/module-hyva-svg-sprite
  2. Run the following Magento commands:

    bin/magento module:enable Taurus_HyvaSvgSprite
    bin/magento setup:upgrade
    bin/magento cache:flush

Manual Installation

  1. Copy the module files to app/code/Taurus/HyvaSvgSprite.
  2. Run the following Magento commands:
    bin/magento module:enable Taurus_HyvaSvgSprite
    bin/magento setup:upgrade
    bin/magento cache:flush

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固