vhs icon indicating copy to clipboard operation
vhs copied to clipboard

Assets using TypoScript unable to force placement in header instead of footer

Open typoworx-de opened this issue 4 years ago • 1 comments

I noticed VHS asset-management seems to stuck enforcing JS to be placed into HTML Head instead of Footer while using vhs-asset using TypoScript.

This is an example running using VHS 6.0.0

plugin.tx_vhs {
    assets {
        tagsAddSubresourceIntegrity = 0
        mergedAssetsUseHashedFilename = 1
    }

    settings {
        asset.debug = 0

        assetGroup {
            core {
                name = core
                standalone = 1
              	relocateToFooter = 0
              	enableFooterRelocation = 0
            }
        }
    }
}

plugin.tx_vhs.settings.asset >
plugin.tx_vhs.settings.asset {
    jQueryJS {
        name = jQueryJS
        path = EXT:my-sitepackage/Resources/Public/Javascript/jquery-1.12.0.min.js
        # also tried with:
        # group = core
        standalone = 1
      	movable = 0
        relocateToFooter = 0
        enableFooterRelocation = 0
    }
}

jQuery is still placed into Footer!!! I also did some code-research into VHS and found settings which where unknown to me yet:

relocateToFooter = 0/1
enableFooterRelocation = 0/1

this is very confusing. What is the purpose of these compared to the already existing 'movable' setting and are all of these settings valid for typoscript asset-includes and fluid-based v:asset.script includes as well?!

In fact I was not able to enforce jQuery to be placed into Head in any combination/way. I have an site-setup which requires jQuery to be present in Head already, so footer-placement or refactoring the whole site is not an option in my case.

As there are already a bunch (?!) of settings which aim to give control over this, I don't understand this feature doesn't seem to work properly at all.

Is there anything wrong with my code above?!

typoworx-de avatar Jun 04 '20 10:06 typoworx-de

I should mention I'm also have optional asset loading in fluid template using v:asset.script which should be loaded "independent" from those assets like jQuery required anyway. Those are rendered as separate script-tag to the one in the footer containing only jQuery (from example code above).

typoworx-de avatar Jun 04 '20 10:06 typoworx-de