WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • Minify CSS & JS
  • Print
Pages: [1]   Go Down

Author Topic: Minify CSS & JS  (Read 4993 times)

Offline dbs

  • Betatester
  • **
  • Posts: 8918
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Minify CSS & JS
« on: September 26, 2019, 11:19:14 AM »
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:
Code: [Select]
<?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;
}
Logged
https://onkel-franky.de

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • Minify CSS & JS
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2