This package creates multiple managed theme infrastructure for Laravel.
Run the install command:
composer require bkeremm/laravel-theme
Register the service provider in config/app.php
Cankod\Theme\ServiceProvider::class,
Add alias if you want to use the facade.
'Theme' => Cankod\Theme\Facade::class,
Publish config file.
php artisan vendor:publish --tag=theme
You can change the options of your app from config/theme.php
file
Just run the artisan command to create a new theme.
php artisan theme:generate
<link rel="stylesheet" href="{{ Theme::asset('app.css') }}">
<script type="javascript" src="{{ Theme::asset('app.js') }}">
or you can create your css and js files automatically by using assetLink helper.
Theme::assetLink('app.css'); // Output: <link rel="stylesheet" href="/themes/default/css/app.css">
Theme::assetLink('app.js');
config/theme.php
contains the following settings.
If you want to change the default created file and folder names with Artisan command, you can do this easily in config/theme.php
.
'current_theme' => 'default',
'views_folder' => [
'layout' => 'layouts',
'component' => 'components',
],
'views_blade' => [
'index' => 'index',
'header' => 'header',
'footer' => 'footer',
'layout' => 'main',
],
'webpack' => [
'folder' => [
'js' => 'js',
'css' => 'sass',
],
'file' => [
'css' => 'app.scss',
'variable' => '_variables.scss',
'js' => 'app.js',
'bootstrap' => 'bootstrap.js',
]
],
'resource_path' => 'themes',
'public_path' => 'themes',
If you want to activate a new theme on the front side, just type the theme name in the current_theme field.
'current_theme' => 'theme_name',
- Webpack Build
- Advanced View Files
Please see CHANGELOG for more information what has changed recently.
The MIT License (MIT). Please see LICENSE for more information.