sourceboat / wp-pug
Use Pug template engine in WordPress.
Installs: 153
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 6
Forks: 0
Open Issues: 0
Type:wordpress-muplugin
Requires
- php: >=5.6.0
- composer/installers: ^1.3
- pug-php/pug: ^2.6
- sourceboat/wp-autoloader: ^0.1.0
Requires (Dev)
This package is auto-updated.
Last update: 2020-11-19 08:23:29 UTC
README
⚠️ Deprecated: This project is not actively maintained anymore. Use it at your own risk.
WP Pug
Use Pug template engine in WordPress. It uses pug-php under the hood.
Installation
To use this plugin you need to setup your WordPress installation via a Composer setup like Bedrock. Then you can install it via:
$ composer require sourceboat/wp-pug
Usage
Template Directory
The Plugin expects your templates to be under a views
folder in your active theme.
Helper
The plugin exposes the following helper functions:
render_template($name, $data = [])
- renders a template and prints the output.get_template_content($name, $data = [])
- renders a template and returns the output as string.
Arguments:
$name
- the template name relative to the template directory without file extension.$data
(optional) - array with local variables wich get passed to the template.
WP-CLI
The plugin supports WP-CLI. The following commands are available:
$ wp pug cache warmup // caches all template files.
$ wp pug cache clear // clears all cached template files.