Minify CSS & JS

dbs

Those using Ruud's experimental module Minify you should consider changing the code in include.php for newer WB versions.

In newer WB versions you can use frontendUser.css and frontendUser.js in all modules (to keep your own changes update safe), but this is not yet included in the Minify module. A small change should fix this. It now looks first for frontendUser.js|css and if not available then for frontend.js|css. Nothing else was changed.

modules/minify/include.php line 146 (whole function _get_frontend), replace with this:
<?php // <-- this line is not needed, only for colored code here

function _get_frontend($type'css') {
    global 
$database,$css,$js;
    
$path _clean_filename(WB_PATH);
    
$query "SELECT DISTINCT `directory` FROM ".TABLE_PREFIX."addons where function='snippet'";
    
$res $database->query($query);
    if(
$res && $res->numRows() > 0) {
        while (
$row $res->fetchRow()) {
            
$fpath $path.'/modules/'.$row['directory'];
            if(
$type=='css' && file_exists($fpath.'/frontendUser.css')) {
                
$css[] = $fpath.'/frontendUser.css';
            } else if (
$type=='css' && file_exists($fpath.'/frontend.css')) {
                
$css[] = $fpath.'/frontend.css';
            }
           
            if(
$type=='js' && file_exists($fpath.'/frontendUser.js')) {
                
$js[] = $fpath.'/frontendUser.js';
            } else if (
$type=='js' && file_exists($fpath.'/frontend.js')) {
                
$js[] = $fpath.'/frontend.js';
            }
        }
    }   
    
$query "SELECT DISTINCT `directory` FROM ".TABLE_PREFIX."addons a JOIN
             "
.TABLE_PREFIX."sections s ON s.module = a.directory";
    
$res $database->query($query);
    if(
$res && $res->numRows() > 0) {
        while (
$row $res->fetchRow()) {
            
$fpath $path.'/modules/'.$row['directory'];
            if(
$type=='css' && file_exists($fpath.'/frontendUser.css')) {
                
$css[] = $fpath.'/frontendUser.css';
            } else if (
$type=='css' && file_exists($fpath.'/frontend.css')) {
                
$css[] = $fpath.'/frontend.css';
            }
           
            if(
$type=='js' && file_exists($fpath.'/frontendUser.js')) {
                
$js[] = $fpath.'/frontendUser.js';
            } else if (
$type=='js' && file_exists($fpath.'/frontend.js')) {
                
$js[] = $fpath.'/frontend.js';
            }
        }
    }
    
$done 1;
}
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]