GSoC/GCI Archive
Google Code-in 2010 WordPress

API for enqueuing script and style elements with content and no href/src attribute

completed by: chalet16

mentors: Austin Matzko

Currently, you can register and enqueue script and link elements with dependencies, so that the order in which JS and CSS files load is controlled.  

For this task, extend the dependencies API to allow someone to register script and style elements that print their JavaScript or CSS inside <script> and <style> elements, respectively, without pointing to an external file.  One route to do this might be to use the add_data method of the $wp_scripts and $wp_styles to assign the content of the elements.

A use-case example for this is something like Cufon, in which one needs to include external JavaScript files for the Cufon functionality and font definition, then in a script block initialize Cufon for particular element matches.  Allowing script block content via the $wp_scripts API would allow developers to set up those scripts to print, in order, using a consistent API, in one place in the code.