How to include JS and CSS resources for a plugin variable
You can use these and Craft automatically adds the files in the appropriate spots.

$output = craft()-&gt;templates-&gt;includeJsFile(UrlHelper::getResourceUrl('plugin/script.js'));

$output .= craft()-&gt;templates-&gt;includeCssResource(UrlHelper::getResourceUrl('plugin/styles.css'));