Ok...take the DocMan snippet. It’s quite an elaborate application on its own, and it is better that it have its own CSS file than to cram all that CSS markup into the main template CSS file, especially since the rest of the web pages won’t use it.
The core has two API functions for including external javascript files, one in the head and one in the body.
# Registers Startup Client-side JavaScript - these scripts are loaded at inside the <head> tag
function regClientStartupScript($src) ...
# Registers Client-side JavaScript - these scripts are loaded at the end of the page
function regClientScript($src)
In the DocMan snippet, I include an external javascript file:
$src="assets/snippets/docman/js/selections.js";
$modx->regClientStartupScript($src);
Now, it is certainly possible to add a style sheet as I do in the snippet:
$fm = "<style type='text/css'>
@import url(assets/snippets/docman/style/docman.css);
</style>";
but it’s ugly, and I’m not completely sure that all browsers will accept a <style> tag in the middle of the body, let alone the include. It would be much nicer if there were an API function similar to that for javascript insertion to plug it into the head of the pages the snippet uses.