bagisto-admin-theme-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Admin Theme Development

Bagisto后台主题开发

Overview

概述

Admin theme development in Bagisto involves creating custom admin panel themes packaged as Laravel packages. The end result is a self-contained package that can be distributed and maintained independently.
Bagisto中的后台主题开发涉及创建打包为Laravel包的自定义后台面板主题。最终成果是一个可独立分发和维护的自包含包。

When to Apply

适用场景

Activate this skill when:
  • Creating custom admin themes as packages
  • Building admin theme packages for distribution
  • Customizing admin panel styling
  • Overriding default admin templates
在以下场景下启用此技能:
  • 将自定义后台主题创建为包
  • 开发用于分发的后台主题包
  • 自定义后台面板样式
  • 重写默认后台模板

Bagisto Admin Theme Architecture

Bagisto后台主题架构

Core Components

核心组件

ComponentPurposeLocation
Theme ConfigurationDefines available admin themes
config/themes.php
Views PathBlade template filesDefined in theme config
Assets PathCSS, JS, imagesDefined in theme config
Admin Service ProviderLoads views and components
packages/Webkul/Admin/src/Providers/AdminServiceProvider.php
组件用途位置
主题配置定义可用的后台主题
config/themes.php
视图路径Blade模板文件在主题配置中定义
资源路径CSS、JS、图片在主题配置中定义
后台服务提供者加载视图和组件
packages/Webkul/Admin/src/Providers/AdminServiceProvider.php

Key Configuration Properties

关键配置属性

php
// config/themes.php
'admin-default' => 'default',

'admin' => [
    'default' => [
        'name' => 'Default',
        'assets_path' => 'public/themes/admin/default',
        'views_path' => 'resources/admin-themes/default/views',
        'vite' => [
            'hot_file' => 'admin-default-vite.hot',
            'build_directory' => 'themes/admin/default/build',
            'package_assets_directory' => 'src/Resources/assets',
        ],
    ],
],
php
// config/themes.php
'admin-default' => 'default',

'admin' => [
    'default' => [
        'name' => 'Default',
        'assets_path' => 'public/themes/admin/default',
        'views_path' => 'resources/admin-themes/default/views',
        'vite' => [
            'hot_file' => 'admin-default-vite.hot',
            'build_directory' => 'themes/admin/default/build',
            'package_assets_directory' => 'src/Resources/assets',
        ],
    ],
],

Reference files — load only what the current task needs

参考文件——仅加载当前任务所需的文件

FileLoad when
creating-a-theme.mdScaffolding the theme package and registering it
assets.mdThe Vite pipeline, the build, and the dev-server workflow
layouts.mdAdmin layouts, Blade components, custom layouts
reference.mdPackage layout, key files, pitfalls, testing
REQUIRED SUB-SKILL: Use bagisto-change-verification before calling any change done.
文件加载时机
creating-a-theme.md搭建主题包并完成注册时
assets.md处理Vite管道、构建及开发服务器工作流时
layouts.md处理后台布局、Blade组件、自定义布局时
reference.md处理包布局、关键文件、常见问题、测试时
必备子技能: 在完成任何修改前,使用bagisto-change-verification进行验证。