We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19302
    • 6 Posts
    Firstly, really quickly - have used minify before on other websites, and due to recent ish integration into revo, decided to try and use the one supplied. I realise this is pretty hackish, but can anyone see any huge issues with something like :

    [[!serveCompressed? &files=`//assets/templates/css/style-one.css,//assets/templates/css/style-two.css`]]
    


    in a page (blank template with content type as css) and the snippet :

    @set_include_path($modx->config['base_path'] . 'manager/min/lib');
    
    $min_cachePath = $modx->cacheManager->getCachePath() . 'min/';
    
    if(!file_exists($min_cachePath)) {
        mkdir($min_cachePath);
    }
    
    require 'Minify.php';
    require 'Minify/Cache/File.php';
    
    Minify::setCache(new Minify_Cache_File($min_cachePath, true));
    
    Minify::serve('Files', array(
        'files' => explode(",", $files),
        'maxAge' => 31556926,
    ));
    


    It seems to work fine (probably with a little overhead going through modx?).

    Secondly, after having a look at the way modx handles it, I found that modx wasn't actually making the cache files for the manager. I don't know if this is in some way the fault of our server setup (is it working for other people?). I'm pretty sure it's like this :

    from index.php in /manager/min :

    $min_cachePath = $modx->cacheManager->getCachePath() . 'mgr/min/';


    I don't think minify actually creates the temp directory, in this case 'min'. After manually making it, all the files appear.

    All of this in Revo 2.2.0-pl2 - checked the changelog for the new version, and couldn't see anything related.