maestriam/samurai

为您的 Laravel 项目创建令人惊叹的主题。

v3.1.6 2024-09-23 19:55 UTC

This package is auto-updated.

Last update: 2024-09-23 19:56:38 UTC


README

maestriam/samurai logo

🔴 maestriam/samurai

为您的 Laravel 项目创建令人惊叹的主题。


Travis (.com) Scrutinizer Code Quality GitHub Last Commit

Maestriam/Samurai 是一个用于创建和管理 Laravel 应用程序主题的简单包,使用 Laravel Blade 的 组件包含 功能。
您可以通过 Composer 发布您的主题并在其他项目中安装。

要求

  • Laravel 8.*^

安装

通过 Composer 安装

composer require maestriam/samurai

将 samurai.php 发布到配置文件夹

php artisan vendor:publish --tag=Samurai

入门指南

创建新主题

php artisan samurai:make-init

使用默认配置创建新主题

php artisan samurai:make-theme my-vendor/my-theme

创建新包含文件

php artisan samurai:make-include my-include my-vendor/my-theme 

theme 参数是可选的。如果未提供,则自动假定默认主题。
要编辑您的包含文件,请访问 themes/my-vendor/my-theme/src/my-include/my-include-include.blade.php

创建新组件

php artisan samurai:make-component my-component my-vendor/my-theme

theme 参数是可选的。如果未提供,则自动假定默认主题。
要编辑您的包含文件,请访问 themes/my-vendor/my-theme/src/my-component/my-component-component.blade.php

在项目中使用主题
要发布您的资产并将当前主题定义为当前主题

php artisan samurai:use my-vendor/my-theme

在 blade 文件中使用组件
要在 view.blade.php 中使用组件,请使用

@myComponent()

    My content inside

@endmyComponent()

现在,您也可以使用 Blade UI 语法

<x-my-component>

    My content inside

</x-my-component>

在 blade 文件中使用包含文件
要在 view.blade.php 中使用包含文件,请使用

@myInclude()

现在,您也可以使用 Blade UI 语法

<x-my-include />

将资产加载到主题文件中
要将任何文件导入您的主题(如 css、js、imgs),请使用指令 @public。
例如

<script src="@public('js/index.js')" />




Giuliano Sampaio 使用 ❤️、☕ 和 🍺 创作而成!