heimrichhannot/contao-components

Components is a contao extension that gives better control over javascript and css invocation within page layouts.

Package info

github.com/heimrichhannot/contao-components

Type:contao-module

pkg:composer/heimrichhannot/contao-components

Statistics

Installs: 24 806

Dependents: 4

Suggesters: 0

Stars: 1

Open Issues: 1

2.2.2 2024-04-23 07:40 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

LGPL-3.0+ a9593c5491e6934216640f576bfbe2c7bc14cef9

javascriptcsslayoutfrontendcontao

This package is auto-updated.

Last update: 2026-06-23 12:07:10 UTC


README

Components is a contao extension that gives better control over javascript and css invocation within page layouts. If you register your javascript and css files as component, it is possible to disable the component for each layout.

Technical instruction

To disable custom js/css components, register them within '$GLOBALS['TL_COMPONENTS']'.

The following example is taken from heimrichhannot/contao-bootstrapper.

$GLOBALS['TL_COMPONENTS'] = array
(
		'bs.inputSlider' => array
 	(
 		'js' => array
 		(
 			'files' => array
 			(
 				'system/modules/bootstrapper/assets/vendor/seiyria-bootstrap-slider/dist/bootstrap-slider' . (!$GLOBALS['TL_CONFIG']['debugMode'] ? '.min' : '') . '.js|static',
 				BOOTSTRAPPER_JS_COMPONENT_DIR . '/input-slider/bs.inputSlider' . (!$GLOBALS['TL_CONFIG']['debugMode'] ? '.min' : '') . '.js|static',
 			),
 		),
 		'css' => array
 		(
 			'files' => array
 			(
 				'system/modules/bootstrapper/assets/vendor/seiyria-bootstrap-slider/dist/css/bootstrap-slider.min.css|screen|static',
 			)
 		),
 	),
 	'bs.tooltip' => array
 	(
 		'js' => array
 		(
 			'files' => array
 			(
 				BOOTSTRAPPER_JS_COMPONENT_DIR . '/tooltip/bs.tooltip' . (!$GLOBALS['TL_CONFIG']['debugMode'] ? '.min' : '') . '.js|static',
 			),
 		)
 	),
 	'modernizr' => array
 	(
 		'js' => array
 		(
 			'files' => array
 			(
 				'system/modules/bootstrapper/assets/vendor/modernizr.min.js|static',
 			),
 			'before' => 0, // invoke always before jquery of the given key
 			//'after' => 'bs.core', // invoke always after bs.core
 		),
 	),
);