-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Laravel Pug | ||
|
||
[![Packagist](https://img.shields.io/packagist/v/bkwld/laravel-pug.svg)](https://packagist.org/packages/bkwld/laravel-pug) | ||
|
||
A small package that adds support for compiling Pug (Jade) templates to Laravel via [Pug.php](https://github.com/pug-php/pug). Both vanilla php and [Blade syntax](http://laravel.com/docs/5.2/templates#blade-templating) is supported within the view. | ||
|
||
|
||
|
||
## Installation | ||
|
||
1. Run `composer require bkwld/laravel-pug` | ||
2. Add the service provider to your app.php providers: `Bkwld\LaravelPug\ServiceProvider::class,` | ||
|
||
|
||
|
||
## Configuration | ||
|
||
All [Pug.php](https://github.com/pug-php/pug) config options are passed through via a Laravel config array. | ||
|
||
* **Laravel 4** : Publish the config file with `php artisan config:publish bkwld/laravel-pug` and edit at /app/config/packages/bkwld/laravel-pug/config.php | ||
* **Laravel 5** : Publish the config file with `php artisan vendor:publish --provider="Bkwld\LaravelPug\ServiceProvider"` and edit it at /config/pug.php. | ||
|
||
|
||
|
||
## Usage | ||
|
||
Laravel Pug registers the ".pug", ".pug.php", ".pug.blade", and ".pug.blade.php" as well as the ".jade", ".jade.php", ".jade.blade", and ".jade.blade.php" extensions with Laravel and forwards compile requests on to Pug.php. It compiles your Pug templates in the same way as Blade templates; the compiled template is put in your storage directory. Thus, you don't suffer compile times on every page load. | ||
|
||
In other words, just put your Pug files in the regular views directory and name them like "whatever.pug". You reference them in Laravel like normal: | ||
|
||
* **Laravel 4** : `View::make('home.whatever')` for `app/views/home/whatever.pug` | ||
* **Laravel 5** : `view('home.whatever')` for `resources/views/home/whatever.pug` | ||
|
||
The Pug view files can work side-by-side with regular PHP views. To use Blade templating within your Pug, just name the files with ".pug.blade" or ".pug.blade.php" extensions. | ||
|
||
|
||
|
||
## Histoy | ||
|
||
Read the Github [project releases](https://github.com/BKWLD/laravel-pug/releases) for release notes. |