bkeremm/laravel-theme

This package is abandoned and no longer maintained. No replacement package was suggested.

This package creates multiple managed theme infrastructure for Laravel.

v1.0.4 2019-08-16 23:06 UTC

This package is auto-updated.

Last update: 2021-03-17 03:09:36 UTC


README

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.