Loading...
Loading...
Shop theme development in Bagisto. Activates when creating custom storefront themes, modifying shop layouts, building theme packages, or working with Vite-powered assets for the customer-facing side of the application.
npx skill4agent add bagisto/agent-skills shop-theme-development| Component | Purpose | Location |
|---|---|---|
| Theme Configuration | Defines available themes | |
| Views Path | Blade template files | Defined in theme config |
| Assets Path | CSS, JS, images | Defined in theme config |
| Theme Middleware | Resolves active theme | |
| Theme Facade | Manages theme operations | |
// config/themes.php
'shop-default' => 'default',
'shop' => [
'default' => [
'name' => 'Default',
'assets_path' => 'public/themes/shop/default',
'views_path' => 'resources/themes/default/views',
'vite' => [
'hot_file' => 'shop-default-vite.hot',
'build_directory' => 'themes/shop/default/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
],mkdir -p packages/Webkul/CustomTheme/src/{Providers,Resources/views}# Copy complete shop assets folder
cp -r packages/Webkul/Shop/src/Resources/assets/* packages/Webkul/CustomTheme/src/Resources/assets/
# Copy complete shop views folder
cp -r packages/Webkul/Shop/src/Resources/views/* packages/Webkul/CustomTheme/src/Resources/views/
# Copy shop package.json for dependencies
cp packages/Webkul/Shop/package.json packages/Webkul/CustomTheme/packages/Webkul/CustomTheme/src/Resources/views/home/index.blade.php<x-shop::layouts>
<x-slot:title>
Custom Theme Home
</x-slot>
{{-- Hero Section --}}
<div class="hero-section bg-gradient-to-r from-blue-600 to-purple-600 text-white py-20">
<div class="container mx-auto px-4 text-center">
<h1 class="text-5xl font-bold mb-6">
Welcome to Our Store
</h1>
<p class="text-xl mb-8 opacity-90">
Professional theme with modern design
</p>
<a href="{{ route('shop.search.index') }}"
class="bg-white text-blue-600 font-bold py-3 px-8 rounded-lg hover:bg-gray-100 transition duration-300">
Start Shopping
</a>
</div>
</div>
{{-- Featured Products --}}
<div class="container mx-auto px-4 py-16">
<h2 class="text-3xl font-bold text-center mb-12">
Featured Products
</h2>
<!-- Product grid -->
</div>
</x-shop::layouts>packages/Webkul/CustomTheme/src/Resources/views/layouts/master.blade.php<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? config('app.name') }}</title>
{{-- Load theme assets manually --}}
@bagistoVite([
'src/Resources/assets/css/app.css',
'src/Resources/assets/js/app.js'
])
@stack('meta')
@stack('styles')
</head>
<body class="{{ $bodyClass ?? '' }}">
@if($hasHeader ?? true)
@include('custom-theme::layouts.header')
@endif
<main class="main-content">
{{ $slot }}
</main>
@if($hasFooter ?? true)
@include('custom-theme::layouts.footer')
@endif
@stack('scripts')
</body>
</html>packages/Webkul/CustomTheme/src/Providers/CustomThemeServiceProvider.php<?php
namespace Webkul\CustomTheme\Providers;
use Illuminate\Support\ServiceProvider;
class CustomThemeServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}
/**
* Bootstrap services.
*/
public function boot(): void
{
// Publish views to resources/themes/custom-theme/views
$this->publishes([
__DIR__ . '/../Resources/views' => resource_path('themes/custom-theme/views'),
], 'custom-theme-views');
}
}composer.json"autoload": {
"psr-4": {
"Webkul\\CustomTheme\\": "packages/Webkul/CustomTheme/src"
}
}composer dump-autoloadbootstrap/providers.phpWebkul\CustomTheme\Providers\CustomThemeServiceProvider::class,config/themes.php'shop-default' => 'custom-theme',
'shop' => [
'default' => [
'name' => 'Default',
'assets_path' => 'public/themes/shop/default',
'views_path' => 'resources/themes/default/views',
'vite' => [
'hot_file' => 'shop-default-vite.hot',
'build_directory' => 'themes/shop/default/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
'custom-theme' => [
'name' => 'Custom Theme Package',
'assets_path' => 'public/themes/shop/custom-theme',
'views_path' => 'resources/themes/custom-theme/views',
'vite' => [
'hot_file' => 'custom-theme-vite.hot',
'build_directory' => 'themes/custom-theme/build',
'package_assets_directory' => 'src/Resources/assets',
],
],
],php artisan vendor:publish --provider="Webkul\CustomTheme\Providers\CustomThemeServiceProvider"php artisan optimize:clear# Navigate to package
cd packages/Webkul/CustomTheme
# Install dependencies
npm install
# Build assets for production
npm run buildpackage.json{
"name": "custom-theme",
"private": true,
"description": "Custom Theme Package for Bagisto",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.2",
"vite": "^4.0.0"
}
}vite.config.jsimport { defineConfig, loadEnv } from "vite";
import laravel from "laravel-vite-plugin";
import path from "path";
export default defineConfig(({ mode }) => {
const envDir = "../../../";
Object.assign(process.env, loadEnv(mode, envDir));
return {
build: {
emptyOutDir: true,
},
envDir,
server: {
host: process.env.VITE_HOST || "localhost",
port: process.env.VITE_PORT || 5173,
cors: true,
},
plugins: [
laravel({
hotFile: "../../../public/custom-theme-vite.hot",
publicDirectory: "../../../public",
buildDirectory: "themes/custom-theme/build",
input: [
"src/Resources/assets/css/app.css",
"src/Resources/assets/js/app.js",
],
refresh: true,
}),
],
};
});tailwind.config.jsmodule.exports = {
content: [
"./src/Resources/**/*.blade.php",
"../../../resources/themes/custom-theme/**/*.blade.php"
],
theme: {
container: {
center: true,
screens: { "2xl": "1440px" },
padding: { DEFAULT: "90px" },
},
screens: {
sm: "525px",
md: "768px",
lg: "1024px",
xl: "1240px",
"2xl": "1440px",
1180: "1180px",
1060: "1060px",
991: "991px",
},
extend: {
colors: {
navyBlue: "#060C3B",
darkGreen: "#40994A",
},
fontFamily: {
poppins: ["Poppins"],
dmserif: ["DM Serif Display"],
},
},
},
plugins: [],
safelist: [{ pattern: /icon-/ }],
};postcss.config.jsmodule.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}config/bagisto-vite.php'custom-theme' => [
'hot_file' => 'custom-theme-vite.hot',
'build_directory' => 'themes/custom-theme/build',
'package_assets_directory' => 'src/Resources/assets',
],# Navigate to package
cd packages/Webkul/CustomTheme
# Install dependencies
npm install
# Start dev server with hot reload
npm run dev
# Build for production
npm run build# Remove published views
rm -rf resources/themes/custom-theme/views
# Create symlink from package to resources
ln -s $(pwd)/packages/Webkul/CustomTheme/src/Resources/views resources/themes/custom-theme/views# After making changes
php artisan vendor:publish --provider="Webkul\CustomTheme\Providers\CustomThemeServiceProvider" --force<x-shop::layouts>
<x-slot:title>
Page Title
</x-slot>
{{-- Page content --}}
</x-shop::layouts>| Prop | Type | Default | Description |
|---|---|---|---|
| Boolean | true | Include header navigation |
| Boolean | true | Show featured section |
| Boolean | true | Include footer |
<x-shop::layouts
:has-header="false"
:has-footer="false"
>
<x-slot:title>
Minimal Page
</x-slot>
{{-- Content without header/footer --}}
</x-shop::layouts>| Component | Usage | Description |
|---|---|---|
| Collapsible sections | Toggle content visibility |
| Navigation trail | Show current page path |
| Action buttons | Loading states supported |
| Data tables | Sorting, filtering, pagination |
| Slide-out panels | Position: top/bottom/left/right |
| Dropdown menus | Position: top-left, bottom-right, etc. |
| Date picker | Based on Flatpickr |
| Date-time picker | Based on Flatpickr |
| Image upload | Multiple images support |
| Dialog boxes | Header, content, footer slots |
| Quantity input | +/- buttons |
| Data tables | Customizable thead/tbody |
| Tab navigation | Position: left/right/center |
| Loading effects | Skeleton loaders |
packages/Webkul/CustomTheme/src/Resources/views/layouts/master.blade.php<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? config('app.name') }}</title>
{{-- Load assets manually for custom layouts --}}
@bagistoVite([
'src/Resources/assets/css/app.css',
'src/Resources/assets/js/app.js'
])
</head>
<body>
@if($hasHeader ?? true)
@include('custom-theme::layouts.header')
@endif
<main>
{{ $slot }}
</main>
@if($hasFooter ?? true)
@include('custom-theme::layouts.footer')
@endif
</body>
</html>packages/Webkul/CustomTheme/
├── src/
│ ├── Providers/
│ │ └── CustomThemeServiceProvider.php
│ └── Resources/
│ ├── assets/
│ │ ├── css/
│ │ │ └── app.css
│ │ ├── js/
│ │ │ └── app.js
│ │ ├── images/
│ │ └── fonts/
│ └── views/
│ ├── layouts/
│ │ └── master.blade.php
│ ├── home/
│ │ └── index.blade.php
│ ├── components/
│ └── ...
├── package.json
├── vite.config.js
├── tailwind.config.js
└── postcss.config.js| File | Purpose |
|---|---|
| Theme configuration |
| Vite asset configuration |
| Shop package registration |
| Theme resolution |
| Theme facade |
| Shop components |