2017 © Pedro Peláez
 

library html-compress-twig

Twig extension for compressing HTML and inline CSS/Javascript

image

nochso/html-compress-twig

Twig extension for compressing HTML and inline CSS/Javascript

  • Monday, February 6, 2017
  • by nochso
  • Repository
  • 4 Watchers
  • 46 Stars
  • 99,941 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 6 Versions
  • 14 % Grown

The README.md

nochso/html-compress-twig extension

Latest Stable Version License Build Status, (*1)

A Twig extension for WyriHaximus/HtmlCompress., (*2)

Currently supported Twig features are:, (*3)

  • Tag
    • {% htmlcompress %} ... {% endhtmlcompress %}
  • Function
    • {{ htmlcompress('some html') }}
  • Filter
    • {{ content|markdown|htmlcompress }}

Any HTML, inline CSS and Javascript will be compressed., (*4)

Installation

  1. Install and use composer in your project.
  2. Require this package via composer:, (*5)

    composer require nochso/html-compress-twig
    

Usage

First register the extension with Twig:, (*6)

$twig = new Twig_Environment($loader);
$twig->addExtension(new \nochso\HtmlCompressTwig\Extension());

Then use it in your templates:, (*7)

{% htmlcompress %}{% endhtmlcompress %}
{{ htmlcompress('<ul> <li>') }}
{{ '<ul> <li>'|htmlcompress }}

Compression is disabled by Twig's debug setting. This is to make development easier, however you can always override it., (*8)

The constructor of this extension takes a boolean parameter $forceCompression. When true, this will force compression regardless of Twig's debug setting. It defaults to false when omitted., (*9)

// Enable compression regardless of Twig's debug setting
$twig->addExtension(new \nochso\HtmlCompressTwig\Extension(true));

History

See CHANGELOG for the full history of changes., (*10)

License

This project is licensed under the ISC license which is MIT/GPL compatible and FSF/OSI approved. See the LICENSE file for the full license text., (*11)

The Versions

06/02 2017

dev-master

9999999-dev

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

The Development Requires

twig css extension javascript html minify compress

06/02 2017

2.0.1

2.0.1.0

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

The Development Requires

twig css extension javascript html minify compress

03/12 2016

2.0.0

2.0.0.0

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

The Development Requires

twig css extension javascript html minify compress

27/01 2016

1.0.1

1.0.1.0

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

The Development Requires

twig css extension javascript html minify compress

14/01 2016

1.0.0

1.0.0.0

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

The Development Requires

twig css extension javascript html minify compress

05/10 2015

0.1

0.1.0.0

Twig extension for compressing HTML and inline CSS/Javascript

  Sources   Download

ISC

The Requires

 

twig css extension javascript html minify compress