Home Chassis Bitrix compression. Bitrix compression module. Paid installation of the Bitrix module from Marketplace

Bitrix compression. Bitrix compression module. Paid installation of the Bitrix module from Marketplace

Today we will learn how to correctly format header.php in Bitrix, how to correctly connect .css and .js in header.php, how to correctly connect jQuery in Bitrix and how to enable compression of .css and .js files in Bitrix.

This is a very acute and pressing problem today. The most frequent requests for modules are related to errors in scripts when jQuery is not connected correctly in header.php, and very often several jQuery are connected, but only one jQuery library should be connected on all pages of the site and the very first one among all site template scripts.

There was a record on one site, I counted 7 connected jQuery libraries, the person was simply tired of looking for errors and there was nowhere to go, when the problem was found and fixed, everything began to work correctly on the site.

So, how should the file be formatted correctly? header.php website template in Bitrix:

  • There should be no spaces or hyphens before
  • The page encoding is set before
  • After the title all meta tags are listed
  • After the meta tags, .css site styles are included
  • And only after connecting .css styles are all .js scripts connected
  • If possible, IE comments should be placed at the very end before the closing tag.
  • Example header.php for HTML 5 DOCTYPE

    New on the site

    >

    Most popular