Please upgrade here. These earlier versions are no longer being updated and have security issues.

Plugin doesn't seem to write consolidated content

This discussion is related to the Consolidate addon.

This plugin is exactly what I've been looking for to optimize my forum, with numerous separate css and javascript files from multiple plugins. Brilliant work!

I gave it a try though, and my site's CSS styling and JS doesn't seem to come through. I verified the existence and write-ability of the Consolidate folder in /cache, the plugin appears to be writing cache files, and calls them in my site's source code. The cache files don't seem to contain any actual CSS or JS. The JS file in /cache/Consolidate, for example, just contained this and nothing more:

/*
* Consolidate '/js/library/jquery.js?v=2.0.18.1'
*/



/*
* Consolidate '/js/library/jquery.livequery.js?v=2.0.18.1'
*/



/*
* Consolidate '/js/library/jquery.form.js?v=2.0.18.1'
*/



/*
* Consolidate '/js/library/jquery.popup.js?v=2.0.18.1'
*/



/*
* Consolidate '/js/library/jquery.gardenhandleajaxform.js?v=2.0.18.1'
*/



/*
* Consolidate '/js/global.js?v=2.0.18.1'
*/



/*
* Consolidate '/applications/dashboard/js/addons.js?v=2.0.18.1'
*/



/*
* Consolidate '/plugins/VanillaMIU/markitup/jquery.markitup.js?v=0.2'
*/



/*
* Consolidate '/plugins/VanillaMIU/markitup/sets/html/set.js?v=0.2'
*/

It's so close to working, it just doesn't appear to actually be consolidating the css and js data.

Thanks for your help!

Comments

  • x00x00 MVP MVP
    edited March 2013

    what version of vanilla? I've not tested it for 2.1

    It seem that it is not finding the source file or there is some error. the path is relative, in some set-up this could cause problems, also a if the leading slash is not removed, it will search from the root directory, which permission and existence wise would not work.

    Are you happy to do some some sleuthing? What is you coding ability? Only if you have a local setup or a test site.

    in you conf/config.php add

     $Configuration['Garden']['Debug'] = TRUE;
     $Configuration['Garden']['Errors']['MasterView'] = 'derror.master.php';
    

    in the _Consolidate method in default.php there is a line

    $FileStr = @file_get_contents($File['href']);
    

    in it place add

     error_reporting(E_ALL);
     $FileStr = file_get_contents($File['href']);
    

    You will have to manually clear the contents of Consolidate folder each time, before you make a new request. so clear it, and make a request see what error comes up.

    you can also try a dump

     var_dump($File['href']);
    

    you might also try

     $FileStr = file_get_contents(PATH_ROOT.DS.$File['href']);
    

    grep is your friend.

  • I'm running 2.0.18.1, but I have applied the various patches to bring it up to 2.0.18.4.

    I don't have a local copy to test on unfortunately, but I will poke around and see what I can do. I don't believe it is the relative path that is the issue, it appears to be linking to existing cache files, they just don't contain anything.

    Looking deeper, there appear to be other cache files containing the consolidated data, but they're not the ones being referenced in the HTML.

    Is it possible that something in my theme would throw it off? I don't believe I've altered the theme in any significant way, but perhaps that is it.

  • I got it to work! I used your code above and applied it to another line as well.

    In default.php line 393:

    $FileStr = @file_get_contents(PATH_ROOT.DS.$File['href']);

    Line 396:

    $FileStr = Minify_CSS_UriRewriter::rewrite($FileStr,dirname(PATH_ROOT.DS.$File['href']),str_replace($this->WebRoot,'',PATH_ROOT));

    It works great, thank you so much! This should really help speed up my website.

    422
  • x00x00 MVP MVP
    edited March 2013

    @crmarks

    I've uploaded a new version with a fix

    http://vanillaforums.org/addon/consolidate-plugin

    Note I can't guarantee it will speed up your site, there are a lot of aspects to performance an optimisation, this does one job not necessarily related.

    grep is your friend.

    crmarks
  • x00x00 MVP MVP
    edited March 2013

    The only one thing about themes is that in some cases people take the master template and add their style sheets and js manually through plain markeup, so in this case the framework just serves it in good faith, it has no awareness of these, and therefore the plugin wouldn't.

    It is also a pretty bad idea to to it this way, themehook are the best way to add these resources. Of course custom.css, etc will automatically be added.

    In fact pretty much everything in the head should be added though the HeadModule, because there is an order to things, in the head (such as title, and meta tags). People risk deleting the head asset, which mean it will never be outputted.

    If you haven’t got a master template in you theme or haven’t modified it, it is probably nothing to worry about.

    grep is your friend.

  • 422422 Developer MVP

    good plugin x00 question for you.

    If vanilla auto detects custom.css then why cant it auto detect custom.js

  • Consolidating my CSS and JS from numerous plugins definitely sped up my website, serving two files is better than serving 12! This is what I had wished to do with the Minify plugin a long time ago, but it never worked for me. This plugin is perfect, this was the last aspect of optimizing my Vanilla forum that I was waiting for a solution for. My forum now earns a 94/100 on Google's PageSpeed Insights test.

    Thank you for all your hard work on this x00!

  • x00x00 MVP MVP
    edited March 2013

    @422 said:
    good plugin x00 question for you.

    If vanilla auto detects custom.css then why cant it auto detect custom.js

    It can

    grep is your friend.

    422UnderDog
  • x00x00 MVP MVP

    New version will clear dead wood out of the cache weekly. It will not clear file actively being used by the cache. Otherwise you can have unused files piling up.

    http://vanillaforums.org/addon/consolidate-plugin

    grep is your friend.

  • @x00 said:
    New version will clear dead wood out of the cache weekly. It will not clear file actively being used by the cache. Otherwise you can have unused files piling up.

    http://vanillaforums.org/addon/consolidate-plugin

    Nice work, the latest version is working great, no more old cache files. Thank you x00!

  • phreakphreak VanillaAPP - White label iOS and Android App MVP
    edited March 2013

    Mmh, in my case Consolidate changes font-sizes, mmh, i wonder how i could find the source for the failure.


    • Vanilla APP » Learn more «
    • iOS & Android App for Vanilla - White label app for your forum
  • x00x00 MVP MVP

    in is probably an order thing.

    Is it changing the size, or is just the wrong font?

    grep is your friend.

Sign In or Register to comment.