kasparsd / minit

A WordPress plugin to combine CSS and Javascript files.
GNU General Public License v2.0
286 stars 46 forks source link

Could we have an examples.php? #53

Closed szepeviktor closed 7 years ago

szepeviktor commented 8 years ago

Example No1: minit-minify.php

add_filter( 'minit-content-js', 'minit_jsqueeze' );
add_filter( 'minit-content-css', 'minit_cssmin' );

function minit_jsqueeze( $javascript ) {

    // https://github.com/tchwork/jsqueeze
    require_once 'lib/JSqueeze.php';

    $jz = new Patchwork\JSqueeze();

    return $jz->squeeze( $javascript, true, true, false );
}

function minit_cssmin( $stylesheet ) {

    // https://github.com/natxet/CssMin
    require_once 'lib/CssMin.php';

    return CssMin::minify( $stylesheet );
}
kasparsd commented 8 years ago

@szepeviktor Awesome, thanks!

There is also an example of minit-exclude-js in include/helpers.php. We should probably add these example to the readme file.

szepeviktor commented 8 years ago

lib/ cloud be include/lib/.

szepeviktor commented 8 years ago

There is also: https://github.com/ianbogda/CSSqueeze which seems more advanced.

szepeviktor commented 7 years ago

Here it is https://github.com/kasparsd/minit/wiki/Minit-Action-and-Filter-Hooks