cwsps154 / theme-maker
用于创建主题组件的工具
v1.0.8
2024-07-06 11:45 UTC
Requires
- php: ^7.4|^8.0|^8.1|^8.2|^8.3
- laravel/framework: ^8.0|^9.0|^10.0|^11.0
README
用于创建主题组件的工具
安装
使用Composer
composer require cwsps154/theme-maker
文档
用法
您可以使用此命令创建新的主题组件和布局
php artisan make:theme
它会询问一些问题
Please enter the name of the theme: \\Type your theme name > MyTheme
What are the components you want to build your theme? (Multiple options are separate by comma) [All]: [0 ] Head [1 ] Header [2 ] Logo [3 ] Navbar [4 ] Sidebar [5 ] Account [6 ] Search [7 ] Notification [8 ] Foot [9 ] Footer [10] All > 10
Do you want any additional components (yes/no) [yes]:
> yes
Please enter the name of the components (Multiple values are separate by comma):
> Profile,Test
0/12 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
INFO Component [app/View/Components/MyTheme/Head.php] created successfully.
1/12 [▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░] 8%
INFO Component [app/View/Components/MyTheme/Header.php] created successfully.
2/12 [▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░] 16%
INFO Component [app/View/Components/MyTheme/Logo.php] created successfully.
3/12 [▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░] 25%
INFO Component [app/View/Components/MyTheme/Navbar.php] created successfully.
4/12 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░] 33%
INFO Component [app/View/Components/MyTheme/Sidebar.php] created successfully.
5/12 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░] 41%
INFO Component [app/View/Components/MyTheme/Account.php] created successfully.
6/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░] 50%
INFO Component [app/View/Components/MyTheme/Search.php] created successfully.
7/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░] 58%
INFO Component [app/View/Components/MyTheme/Notification.php] created successfully.
8/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░] 66%
INFO Component [app/View/Components/MyTheme/Foot.php] created successfully.
9/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░] 75%
INFO Component [app/View/Components/MyTheme/Footer.php] created successfully.
10/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░] 83%
INFO Component [app/View/Components/MyTheme/Profile.php] created successfully.
11/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░] 91%
INFO Component [app/View/Components/MyTheme/Test.php] created successfully.
12/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
File : /var/www/html/TestApp/resources/views/layout/mytheme/mytheme_layout.blade.php created
Theme successfully created
The mytheme_layout.blade.php
<!DOCTYPE html> <html lang='{{ str_replace('_', '-', app()->getLocale()) }}'> <x-mytheme.head> @stack("styles") </x-mytheme.head> <body> <x-mytheme.header/> <x-mytheme.navbar/> <x-mytheme.sidebar/> @yield("content") <x-mytheme.footer/> <x-mytheme.foot> @stack("scripts") </x-mytheme.foot> </body> </html>
以发布配置文件
php artisan vendor:publish --tag=config
创建一个新的ENV变量LAYOUT并设置您的布局名称,或者您可以直接更新此配置文件
return [ 'layout' => env('LAYOUT') ];
在blade页面中使用布局
@extends(config('theme.layout')) @push('styles') \\Custom CSS @endpush @section('content') \\Blade Contant @endsection @push('scripts') \\Custom Scripts @endpush
变更日志
- v1.0.0 - 初始版本
- v1.0.1 - 修改了包依赖,引入了配置文件并修复了错误
- v1.0.2 - 修复了错误
- v1.0.3 - 修复了错误
- v1.0.4 - 修复了错误
- v1.0.5 - 更新了ReadMe
作者
- Github @CWSPS154
- Gmail @codewithsps154@gmail.com