DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:event:css_styles_included

CSS_STYLES_INCLUDED

Description:
modify or prevent the list of included CSS files
DefaultAction:
specified CSS will be added to the result of css.php
Preventable:
yes
Added:
2017-08-01

This event is signalled by css_out() in lib/exe/css.php. It allows to modify the list of CSS files that will be returned to the client.

The event is called multiple times, once for each media type ('screen', 'all', 'print', 'speech') and once for the special type DW_DEFAULT.

If the event is prevented, the list of files will not be added to the resulting CSS.

Passed Data

The passed data is prepared using the css_filewrapper() function.

array(
  'files'               => $files,               // a list of files with CSS for the mediatype
  'mediatype'           => $mediatype,           // type of the media
  'encapsulate'         => $mediatype != 'all',  // default encapsulation option
  'encapsulationPrefix' => '@media '.$mediatype  // default encapsulation prefix
);
  • files: list of files that can also be manipulated. Adding and removing styles as you need them is possible
  • encapsulate: determines whether the resulting CSS of this media type should be encapsulated with curly brackets. The encapsulationPrefix will be written in front of it
  • encapsulationPrefix: the prefix, by default @media <mediatype> - e.g. @media screen

Special media type: DW_DEFAULT

The special media type DW_DEFAULT is for the default DokuWiki interwiki and filetype CSS. The sole purpose of the event with this media type is to be prevented if you do not want these default styles in your resulting CSS.

See also

devel/event/css_styles_included.txt · Last modified: 2018-12-08 15:12 by torpedo

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki