a better way for plugin-developers to add css and javascript?

  1. Frank Goossens


    instead of expecting plugin developers to echo their links to external css and js in wp_head, it might make sense to have 2 functions; register_external_css and register_external_javascript?

    both would be similar, only css would be added in the <head>-section and javascript at the end of the html (as performance-geeks consider best practice).

    a 2nd step could be that all css which is registered that way, gets fetched with one call (one css-file containing all registered css) as would be all javascript (again; one js-file containing all registered javascript), that way minimizing the amount of http-calls?

    Posted: 9 years ago #
  2. Frank Goossens


    been thinking about this some more;
    * this should not only be used by plugin-developers, but also by theme-wizards (and even by wp-core if applicable?)
    * it could not only be used to declare links to external css or js, but also to dump css- or js-code. so one could do;
    register_css(".plugin {display:block}");
    register_js("alert('js registered ok');");

    Posted: 9 years ago #
  3. Jen

    Closing thread because a year has passed and it has not received any community comments.

    Posted: 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    5 Votes
  • Status

    Sorry, not right now