Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
2 posts Page 1 of 1
Hi,

I was missing a HTML minifier feature, so I used the tiny-html-minifier from https://github.com/jenstornell/tiny-html-minifier
tiny-html-minifier.zip
(2.78 KiB) Downloaded 31 times

Installation:
  1. Download Add-On
  2. Extract directory `tiny-html-minifier` in 'couch/addons' folder.
  3. Add the following entry in 'couch/addons/kfunctions.php' file (if this file is not found, rename the kfunctions.example.php file to kfunctions.php)
    Code: Select all
    require_once( K_COUCH_DIR.'addons/tiny-html-minifier/TinyMinify.php' );
Usage
This addon makes available a new tag called minify. It is very simple to use:
Code: Select all
<cms:minify>
    <!-- here comes your HTML and CMS code :) -->
    <p>Compression works:</p>
    <ul>
        <li>
            Really?
        </li>
        <li>
            Really!
        </li>
    </ul>
</cms:minify>

Code will minified to:
Code: Select all
<p>Compression works:</p> <ul> <li> Really? </li> <li> Really! </li> </ul> 

You can set two additional parameter (collapse_whitespace and disable_comments) to true or false (default is false):
Code: Select all
<cms:minify collapse_whitespace="true" disable_comments="true"></cms:minify>


Requirements
PHP7+

Hope, you like and need it ;)
Awesome, will test this out! Thank you! Happy friday ;)
2 posts Page 1 of 1

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests