Extras catalogue

AddHeaderfiles

Latest release 13 years ago (October 21, 2013).

addheaderfiles

  • By jako

About

AddHeaderfiles is an elegant tool for MODX Revolution. With this tool the MODX regClient functions are used to insert Javascript and CSS styles at the appropriate positions of the current page. Since those functions don't insert the same filename twice, the snippet could be called everywhere in the template, document or in chunks to collect all needed Javascripts and CSS styles together. 

Works well with minifyRegistered.

Installation & usage

Parameters:

  • addcode - External filenames(s) or chunkname(s) separated by `sep`. These external files can have a position setting or media type separated by `sepmed`
  • sep - Separator for files/chunknames (default ';')
  • sepmed - Seperator for media type or script position (default '|')
  • mediadefault - Media default for css files (default 'screen, tv, projection')

Example Calls (anywhere in the document or template):

Direct call:

[[!AddHeaderfiles?addcode=`/assets/js/jquery.js;/assets/js/colorbox.js|end;/assets/css/colorbox.css;/assets/css/test.css|print`]]

Chunk call:

Fill a chunk (i.e. 'headerColorbox') like this:

/assets/js/jquery.js;/assets/js/colorbox.js|end;/assets/css/colorbox.css

[[!AddHeaderfiles?addcode=`headerColorbox`]]

Parts of the addcode parameterchain could point to chunks (recursive). The parts of the chain that are not pointing to other chunks or to files/uri should contain the complete script or css code.

[[!AddHeaderfiles?addcode=`headerColorbox;/assets/css/test.css|print`]]

Full documentation on https://github.com/Jako/AddHeaderfiles-revo

At a glance

Not MODX 3 compatible as far as we know.

  • Developer jako
  • Latest release October 21, 2013 (13 years ago)
  • First seen in SiteDash July 18, 2013 (13 years ago)
  • License GPLv2
  • MODX support 2.2+
  • Databases MySQL

Releases 2 indexed releases

Changelog
MODX.com

0.6.1-pl

October 21, 2013

13 years ago

<ul><li>better external css file detection</li></ul>
MODX.com

0.6-pl

July 18, 2013

13 years ago

—