Using VanillaStats with the DeferJs option

This discussion is related to the Consolidate addon.
BleistivtBleistivt MVP
edited August 2014 in Feedback

Continuing my other thread...

So this is more of an issue with vanillastats as it inserts javascript into the page body:
https://github.com/vanilla/vanilla/blob/master/plugins/VanillaStats/views/dashboard.php#L38

What I did is this:

if (
    && ($Sender->SelfUrl == 'dashboard/settings' || $Sender->SelfUrl == 'settings')
    && C('EnabledPlugins.VanillaStats')
) {
    SaveToConfig('Plugins.Consolidate.DeferJs', false, array('Save' => false));
}

so js will not be deferred to the bottom on the dashboard main page.
This can be put into Base_Render_Before, for example.

By the way, this plugin is great. Garden.CombineAssets never really worked on my setup, but this does.

My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

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

Comments

  • Yes as you know defer, option can be highly volatile. If you are happy with your solution good for you.

    I'd also be happy to put exclusion rules if someone will sponsor it.

    As this is a core feature, maybe open up a ticket, to add statistics in a more queued vanilla way. However I'd expect it is not high priority, but would let them know for the future.

    grep is your friend.

  • @Bleistivt I noticed with one client using the defer option both the consolidated and the non consolidated asset were included can you confirm if this is the case with you?

    grep is your friend.

  • No, when using the defer option there are just a few empty lines where the cascade of script tags used to be. (I'm on 2.1)

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

    • Vanilla APP » Learn more «
    • iOS & Android App for Vanilla - White label app for your forum
  • so basically it works as expected.

    grep is your friend.

    Bleistivt
Sign In or Register to comment.