Separating JSS from CSS on plone.htmlhead

I am using Plone 3.1.7 in a project that needs performance tweaks. One trick requires CSS to be at the top of the page, and JS must be at the bottom. However, both are located in

<div tal:replace="structure provider:plone.htmlhead" />

In main_template. How to separate them?

Thanks in advance

+3
source share
5 answers

My workmates found a solution:

plone.htmlhead is a widget registered with plone.app.layout that downloads three other views:

  • plone.resourceregistries.styles
  • plone.resourceregistries.scripts
  • plone.resourceregistries.kineticstylesheets

I put the following in the HEAD tag:

<div tal:replace="structure provider:plone.resourceregistries.styles" />

And the following:

<div tal:replace="structure provider:plone.resourceregistries.scripts" />
<div tal:replace="structure provider:plone.resourceregistries.kineticstylesheets" />

! CSS , JS

+3

Plone, JS, - ( ).

, - , ( :)

+1

Products.ResourceRegistries. ​​ 2.02b. :

[versions]
    ...
    Products.ResourceRegistries == 2.02b
    ...

buildout, .

0

, plone.htmlhead, 3 , , ( SEO). , plone.htmlhead.

The best solution seems to be to use newer products. ResourceRegistries suggested above, except that the assembly lines are a bit wrong. The following worked for me:

[options]

...
Products.ResourceRegistries=2.0b3
...
0
source

In the head tag except

<div tal:replace="structure provider:plone.resourceregistries.styles" />

I put

<title tal:define="page_title python: context_state.object_title()"
       tal:content="page_title">page title</title>

....
but in fact I lost all the meta strong> tags associated with the keywords!

0
source

Source: https://habr.com/ru/post/1736194/


All Articles