Skip to content
This package creates multiple managed theme infrastructure for Laravel.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Fixed issue with assetLink path Aug 16, 2019
.gitignore
CHANGELOG.md
LICENSE
README.md Install Command Changed README Aug 15, 2019
composer.json

README.md

Laravel Theme

Laravel Template Builder

Latest Stable Version Total Downloads License

This package creates multiple managed theme infrastructure for Laravel.

Getting Started

1. Install

Run the install command:

composer require bkeremm/laravel-theme

2. Register (for Laravel < 5.5)

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,

3. Publish

Publish config file.

php artisan vendor:publish --tag=theme

4. Configure

You can change the options of your app from config/theme.php file

Usage

Just run the artisan command to create a new theme.

php artisan theme:generate

Facade

<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'); 

Configure

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', 

What's next?

  • Webpack Build
  • Advanced View Files

Changelog

Please see CHANGELOG for more information what has changed recently.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.

You can’t perform that action at this time.