GithubHelp home page GithubHelp logo

hason / jade-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kylekatarnls/jade-php

0.0 1.0 0.0 1.13 MB

Jade template engine ported to PHP 5.3

Home Page: https://github.com/pugjs/pug

License: MIT License

PHP 82.06% HTML 16.92% CSS 0.37% JavaScript 0.65%

jade-php's Introduction

Pug.php

Latest Stable Version Total Downloads Build Status StyleCI codecov.io Code Climate Reference Status

Pug.php adds inline PHP scripting support to the Pug template compiler.

Pug has been recently re-named from Jade. If you're new to Pug, you should install the pug-php/pug package on composer.

The Pug Syntax Reference

Implementation details

The fork is a complete rewrite, all the code is ported from the original jade project.

All the features from the original are supported but undertested, including inheritance and mixins.

Install using composer

composer require pug-php/pug
composer install

pug-php/pug on packagist.org

Pug in your favorite framework

Phalcon: https://github.com/kylekatarnls/jade-phalcon

Symfony: https://github.com/kylekatarnls/jade-symfony

CodeIgniter: https://github.com/kylekatarnls/ci-jade

Pug options

Pug options should be passed to the Jade construction

$pug = new Pug(array(
	'prettyprint' => true,
	'extension' => '.pug',
	'cache' => 'pathto/writable/cachefolder/'
);

Supports for local variables

$pug = new Pug();
$output = $pug->render('file', array(
	'title' => 'Hello World'
));

Supports for custom filters

Filters must be callable: It can be a class that implements the __invoke() method, or an anonymous function.

$pug->filter('escaped', 'My\Callable\Class');

// or

$pug->filter('escaped', function($node, $compiler){
	foreach ($node->block->nodes as $line) {
		$output[] = $compiler->interpolate($line->value);
	}
	return htmlentities(implode("\n", $output));
});

Built-in filters

  • :css
  • :php
  • :javascript
  • :escaped
  • :cdata

Install other filters with composer

http://pug-filters.selfbuild.fr/

Publish your own filter

https://github.com/kylekatarnls/jade-filter-base#readme

jade-php's People

Contributors

cjonasw avatar djranger avatar everzet avatar fcrosfly avatar hackaugusto avatar hkjels avatar just-paja avatar krizalys avatar kylekatarnls avatar lukegb avatar peniar avatar sadjow avatar sisoftrg avatar soviut avatar sszigeti avatar volter9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.