Skip to content

amin4code/Theme

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theme support for Laravel

Inspired by bigecko/laravel-theme. Themes are stored inside default laravel's resources folder

Installation

Require this package in your composer.json:

composer require yaap/theme

Or manually add

"yaap/theme": "4.*"

Optionally, publish config using artisan CLI (if you want to overwrite default config).

php artisan vendor:publish --provider="YAAP\Theme\ThemeServiceProvider"

Package config

	return array(
        'path'          => base_path('resources/themes'),
        'assets_path'   => 'themes',
    );

Theme config

	return array(
        'name'         => 'default',
        'inherit'      => null,
    );

Usage

Structure

├── themes/
    ├── default/
    |   ├── assets/        
        ├── lang/        
        ├── layouts/
        ├── partials/
        ├── views/
        |   └── hello.blade.php
        └── config.php

    └── admin/

    ├── views/
    |   ├── emails/
    |   |   └── notify.blade.php
    |   └── hello.blade.php

├── public/
    └── themes/
		└── default/
			├── css/
			|	└── styles.css
			└── images/
                └── icon.png

Create theme with artisan CLI

The first time you have to create theme "default" structure, using the artisan command:

php artisan theme:create default

In order to seed webpack.mix.js with custom rules add --with-mix option

php artisan theme:create default --with-mix

To delete an existing theme, use the command:

php artisan theme:destroy default

Init theme

Theme::init($name)

This will add to views find path:

  • themes/{$name}
  • themes/{$name}/views

Lang files will be added as well:

  • themes/{$name}/lang

Making view

View::make('hello');
View::make('emails.notify');

Assets

Use laravel mix for assets.

<link rel="stylesheet" href="{{ mix('/themes/default/css/app.min.css') }}"/>
<script type="text/javascript" src="{{ mix('/themes/default/js/app.min.js') }}"></script>

###Blade templates

	@extends('layouts.master')

	@include('partials.header')

	@section('content')

	    <section id="main">
	        <h1>HOME</h1>
	    </section>
	@stop

	@include('partials.footer')

###Fallback capability

You still able to use default View::make('emails.notify') which is stored outside the themes directory

Can I hire you guys?

Yes! Say hi: [email protected]
We will be happy to work with you! Other work we’ve done

Follow us

Stay up to date with the latest Vuestic news! Follow us on LinkedIn or Facebook

License

MIT license.

About

Laravel's theme manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • PHP 93.9%
  • Blade 2.9%
  • JavaScript 2.6%
  • SCSS 0.6%