Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acidjazz/larpug
Pug templating adapter for laravel and lumen
https://github.com/acidjazz/larpug
blade jade laravel lumen objectus pug
Last synced: 3 months ago
JSON representation
Pug templating adapter for laravel and lumen
- Host: GitHub
- URL: https://github.com/acidjazz/larpug
- Owner: acidjazz
- License: apache-2.0
- Created: 2016-07-22T02:27:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T15:19:38.000Z (over 7 years ago)
- Last Synced: 2024-09-28T08:42:35.042Z (4 months ago)
- Topics: blade, jade, laravel, lumen, objectus, pug
- Language: PHP
- Homepage:
- Size: 85 KB
- Stars: 42
- Watchers: 5
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
[![](media/pug128.png)](https://github.com/pugjs/pug)
![](media/and128.png)
[![](media/laravel128.png)](https://laravel.com)
![](media/plus128.png)
[![](media/lumen128.png)](https://lumen.laravel.com)Allows you to use native [Pug](https://pugjs.org/) (formerly [Jade](https://github.com/scrooloose/syntastic/pull/1704)) seamlessly in [Laravel 5](http://laravel.com) and [Lumen](http://lumen.laravel.com)
[![Total Downloads](https://poser.pugx.org/acidjazz/larpug/downloads)](https://packagist.org/packages/acidjazz/larpug)
[![Latest Stable Version](https://poser.pugx.org/acidjazz/larpug/v/stable)](https://packagist.org/packages/acidjazz/larpug)
[![License](https://poser.pugx.org/acidjazz/larpug/license)](https://packagist.org/packages/acidjazz/larpug)
[![Build Status](https://travis-ci.org/acidjazz/larpug.svg?branch=master)](https://travis-ci.org/acidjazz/larpug)
[![Dependency Status](https://www.gemnasium.com/badges/github.com/acidjazz/larpug.svg)](https://www.gemnasium.com/github.com/acidjazz/larpug)
[![codecov](https://codecov.io/gh/acidjazz/larpug/branch/master/graph/badge.svg)](https://codecov.io/gh/acidjazz/larpug)[![Join the chat at https://gitter.im/acidjazz/larpug](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/acidjazz/larpug?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# Requirements
* [NodeJS v6.x](https://nodejs.org/en/)
* [npm v3.x](https://www.npmjs.com/)# Installation
Require this package with Composer
```bash
composer require acidjazz/larpug
```Install the needed node modules to run pug
```bash
npm i --prefix vendor/acidjazz/larpug/node/
```## Laravel
Once Composer has installed or updated your packages you need to register larpug with Laravel itself. Open up config/app.php and find the providers key, towards the end of the file, and add 'larpug\LarpugServiceProvider', to the end:
```php
'providers' => [
...
Larpug\ServiceProvider::class,
],
```
## LumenFor usage with [Lumen](http://lumen.laravel.com), add the service provider in `bootstrap/app.php`.
```php
$app->register(Larpug\ServiceProvider::class);
```# Usage
Using this is exactly the same way as using Blade templates, place your pug files in your `views` folder (usually in `resources/views`) and render them using `view()`
```php
namespace App\Controllers;class Pages extends Controller
{
public function index()
{
return view('pages.index', ['name' => 'kevin', 'title' => 'test title']);
}}
```This will look for `resources/views/pages/index.pug`
```pug
doctype
html(lang='en')
head
title Title: #{self.title}
body
.page.index
.name=self.name
```Which will render something like
```html
Title: test title
Kevin
';
```