2017 © Pedro Peláez
 

library theme

A modular themeing system based on the blade syntax.

image

andheiberg/theme

A modular themeing system based on the blade syntax.

  • Tuesday, January 2, 2018
  • by AndreasHeiberg
  • Repository
  • 1 Watchers
  • 2 Stars
  • 315 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 19 Versions
  • 1 % Grown

The README.md

Theme

A simple modular approach to theming created to blend in with Blade.

The concept is to split your theme up into modules that can be reused and changed easily. These modules are stored as simple view files in resources/views/vendor/theme. An example of a typical module could be a hero unit. You would store your hero model like so:, (*1)

+@form(['route' => 'auth.register'])
    +@formText('username', 'What do you want to be called?')->placeholder('darthvader')

    +@formPassword('password') // if you don't provide a label it will capitalize the key

    +@formHidden('awesomeness', 11)

    +@formSelect('gender', 'Your gender', ['Male', 'Female'])->required()

    +@formDate('born_at', 'Birthdate')
-@form

It's especially powerful for forms. By default it will fill old values and show validation messages. It reduces view code by +10x for typical forms., (*2)

It can be used for anything though. Modules are easy to define., (*3)

// resources/views/vendor/theme/hero.blade.php
<div class="hero row {{ $class }}">
    <div class="column">

<!-- Content -->

    </div>
</div>

This module can then intern be used from a view like so:, (*4)

+@hero()
    <h1>It might be yet another twitter client, but this one is really nice</h1>
    <p>Seriously I mean it I wouldn't want to disapoint you, but it's amazing.</p>
-@hero

As you can see the html comment <!-- Content --> seperates the start and ending of modules. If you choose to exclude this comment you could create a module like so:, (*5)

// app/views/theme/button.blade.php
<a class="button {{ $class }}" href="{{ $link }}">{{ $text }}</a>

And use it like so (without an ending tag):, (*6)

+@button('url', 'text')

Also multiword modules are like so:, (*7)

// app/views/theme/page-header.blade.php
<div class="page-header {{ $class }}">
<!-- Content -->
</div>

And called like so:, (*8)

+@pageHeader()
    <h1>Some header</h1>
-@pageHeader

Why is this helpful?

  • Easily change your markup site wide (this is really useful if you start prototyping with Bootstrap or Foundation and then want to use your own markup later)
  • Easier to modify and understand than something like Former
  • Easier to read (ever seen comments like <!-- end of hero -->? well now the modules end is prefixed by -@ so that should no longer be needed)

Installation

Add the following to your composer.json:, (*9)

"andheiberg/theme": "4.0.*" // "1.0.*" for Laravel 4.1 support, "2.0.*" for Laravel 4.2 support, "3.1.*" for Laravel 5 and 5.1 support

Add Theme's service provider to your Laravel application in config/app.php. Add the following to the providers:, (*10)

Andheiberg\Theme\ThemeServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,

And to the aliases:, (*11)

'Form' => Collective\Html\FormFacade::class,

If you would like to use another theme than default you would have to publish the settings and change the theme setting:, (*12)

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

The Versions

02/01 2018

4.0.x-dev

4.0.9999999.9999999-dev

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

02/01 2018

dev-master

9999999-dev

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

02/01 2018

4.0.1

4.0.1.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

17/07 2016

4.0.0

4.0.0.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

06/10 2015

3.0.x-dev

3.0.9999999.9999999-dev

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

06/10 2015

3.1.1

3.1.1.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

27/08 2015

3.1.0

3.1.0.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

01/08 2015

3.0.1

3.0.1.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

01/08 2015

3.0.0

3.0.0.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

07/06 2015

2.0.x-dev

2.0.9999999.9999999-dev

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

07/06 2015

2.0.4

2.0.4.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

07/06 2015

2.0.3

2.0.3.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

07/06 2015

2.0.2

2.0.2.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

by Andreas Peter Heiberg

04/06 2014

2.0.1

2.0.1.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

30/05 2014

2.0.0

2.0.0.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

24/02 2014

1.0.x-dev

1.0.9999999.9999999-dev

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

21/01 2014

1.0.3

1.0.3.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

07/01 2014

1.0.2

1.0.2.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires

 

30/12 2013

1.0.0

1.0.0.0

A modular themeing system based on the blade syntax.

  Sources   Download

The Requires