ivoschimani/loadscripts

Allows optimized loading of JS and CSS.

Installs: 67

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:contao-bundle

v0.1.12 2024-01-30 10:26 UTC

This package is auto-updated.

Last update: 2024-04-30 00:51:30 UTC


README

Introduction

The Module allows to specify which CSS / JS should be loaded in the <head>-Tag and which at the end of the <body>-Tag. The CSS and JS Files will be combined and Minimized. The CSS Files in the <head>-Tag will be embeded as inline Style. JS Files in the <head>-Tag smaller than 20kb will also be embeded as inline Javascript.

Usage

The Module adds new Fields to the Layout table where you can select your files which should be loaded in the <head>- and <body>-Tag

You could also use the $GLOBALS Array in your Template to load your Files.

Add your Files to the $GLOBALS['TL_CSS_HEAD'] / $GLOBALS['TL_JAVASCRIPT_HEAD'] Arrays to load your files in the <head>-Tag and the $GLOBALS['TL_JAVASCRIPT'] / $GLOBALS['TL_CSS'] Arrays to load your Files at the end of the <body>-Tag

If you use jQuery you could add some js code to the $GLOBALS['TL_JAVASCRIPT_QUEUE'] Array. The Code will be executed after jQuery is Loaded.

The Module will work with the most custom extensions if you change the Templates. In many cases you have to add the inline JS Functions without the <script>-Tag to the $GLOBALS['TL_JAVASCRIPT_QUEUE'] Array.